...**/!(*.map|*.min.js)Size
Gzip
Dependencies
Publish
Install
Publish
Install
@@ -12,14 +12,15 @@ | ||
| 12 | 12 | var undefined; |
| 13 | 13 | |
| 14 | 14 | /** Used as the semantic version number. */ |
| 15 | var VERSION = '4.17.20'; | |
| 15 | var VERSION = '4.17.21'; | |
| 16 | 16 | |
| 17 | 17 | /** Used as the size to enable large array optimizations. */ |
| 18 | 18 | var LARGE_ARRAY_SIZE = 200; |
| 19 | 19 | |
| 20 | 20 | /** Error message constants. */ |
| 21 | 21 | var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', |
| 22 | FUNC_ERROR_TEXT = 'Expected a function'; | |
| 22 | FUNC_ERROR_TEXT = 'Expected a function', | |
| 23 | INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`'; | |
| 23 | 24 | |
| 24 | 25 | /** Used to stand-in for `undefined` hash values. */ |
| 25 | 26 | var HASH_UNDEFINED = '__lodash_hash_undefined__'; |
@@ -152,11 +153,12 @@ | ||
| 152 | 153 | var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, |
| 153 | 154 | reHasRegExpChar = RegExp(reRegExpChar.source); |
| 154 | 155 | |
| 155 | /** Used to match leading and trailing whitespace. */ | |
| 156 | var reTrim = /^\s+|\s+$/g, | |
| 157 | reTrimStart = /^\s+/, | |
| 158 | reTrimEnd = /\s+$/; | |
| 156 | /** Used to match leading whitespace. */ | |
| 157 | var reTrimStart = /^\s+/; | |
| 159 | 158 | |
| 159 | /** Used to match a single whitespace character. */ | |
| 160 | var reWhitespace = /\s/; | |
| 161 | ||
| 160 | 162 | /** Used to match wrap detail comments. */ |
| 161 | 163 | var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, |
| 162 | 164 | reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, |
@@ -165,6 +167,18 @@ | ||
| 165 | 167 | /** Used to match words composed of alphanumeric characters. */ |
| 166 | 168 | var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; |
| 167 | 169 | |
| 170 | /** | |
| 171 | * Used to validate the `validate` option in `_.template` variable. | |
| 172 | * | |
| 173 | * Forbids characters which could potentially change the meaning of the function argument definition: | |
| 174 | * - "()," (modification of function parameters) | |
| 175 | * - "=" (default value) | |
| 176 | * - "[]{}" (destructuring of function parameters) | |
| 177 | * - "/" (beginning of a comment) | |
| 178 | * - whitespace | |
| 179 | */ | |
| 180 | var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; | |
| 181 | ||
| 168 | 182 | /** Used to match backslashes in property paths. */ |
| 169 | 183 | var reEscapeChar = /\\(\\)?/g; |
| 170 | 184 | |
@@ -994,6 +1008,19 @@ | ||
| 994 | 1008 | } |
| 995 | 1009 | |
| 996 | 1010 | /** |
| 1011 | * The base implementation of `_.trim`. | |
| 1012 | * | |
| 1013 | * @private | |
| 1014 | * @param {string} string The string to trim. | |
| 1015 | * @returns {string} Returns the trimmed string. | |
| 1016 | */ | |
| 1017 | function baseTrim(string) { | |
| 1018 | return string | |
| 1019 | ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') | |
| 1020 | : string; | |
| 1021 | } | |
| 1022 | ||
| 1023 | /** | |
| 997 | 1024 | * The base implementation of `_.unary` without support for storing metadata. |
| 998 | 1025 | * |
| 999 | 1026 | * @private |
@@ -1327,6 +1354,21 @@ | ||
| 1327 | 1354 | } |
| 1328 | 1355 | |
| 1329 | 1356 | /** |
| 1357 | * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace | |
| 1358 | * character of `string`. | |
| 1359 | * | |
| 1360 | * @private | |
| 1361 | * @param {string} string The string to inspect. | |
| 1362 | * @returns {number} Returns the index of the last non-whitespace character. | |
| 1363 | */ | |
| 1364 | function trimmedEndIndex(string) { | |
| 1365 | var index = string.length; | |
| 1366 | ||
| 1367 | while (index-- && reWhitespace.test(string.charAt(index))) {} | |
| 1368 | return index; | |
| 1369 | } | |
| 1370 | ||
| 1371 | /** | |
| 1330 | 1372 | * Used by `_.unescape` to convert HTML entities to characters. |
| 1331 | 1373 | * |
| 1332 | 1374 | * @private |
@@ -12494,7 +12536,7 @@ | ||
| 12494 | 12536 | if (typeof value != 'string') { |
| 12495 | 12537 | return value === 0 ? value : +value; |
| 12496 | 12538 | } |
| 12497 | value = value.replace(reTrim, ''); | |
| 12539 | value = baseTrim(value); | |
| 12498 | 12540 | var isBinary = reIsBinary.test(value); |
| 12499 | 12541 | return (isBinary || reIsOctal.test(value)) |
| 12500 | 12542 | ? freeParseInt(value.slice(2), isBinary ? 2 : 8) |
@@ -14866,6 +14908,12 @@ | ||
| 14866 | 14908 | if (!variable) { |
| 14867 | 14909 | source = 'with (obj) {\n' + source + '\n}\n'; |
| 14868 | 14910 | } |
| 14911 | // Throw an error if a forbidden character was found in `variable`, to prevent | |
| 14912 | // potential command injection attacks. | |
| 14913 | else if (reForbiddenIdentifierChars.test(variable)) { | |
| 14914 | throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT); | |
| 14915 | } | |
| 14916 | ||
| 14869 | 14917 | // Cleanup code by stripping empty strings. |
| 14870 | 14918 | source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source) |
| 14871 | 14919 | .replace(reEmptyStringMiddle, '$1') |
@@ -14979,7 +15027,7 @@ | ||
| 14979 | 15027 | function trim(string, chars, guard) { |
| 14980 | 15028 | string = toString(string); |
| 14981 | 15029 | if (string && (guard || chars === undefined)) { |
| 14982 | return string.replace(reTrim, ''); | |
| 15030 | return baseTrim(string); | |
| 14983 | 15031 | } |
| 14984 | 15032 | if (!string || !(chars = baseToString(chars))) { |
| 14985 | 15033 | return string; |
@@ -15014,7 +15062,7 @@ | ||
| 15014 | 15062 | function trimEnd(string, chars, guard) { |
| 15015 | 15063 | string = toString(string); |
| 15016 | 15064 | if (string && (guard || chars === undefined)) { |
| 15017 | return string.replace(reTrimEnd, ''); | |
| 15065 | return string.slice(0, trimmedEndIndex(string) + 1); | |
| 15018 | 15066 | } |
| 15019 | 15067 | if (!string || !(chars = baseToString(chars))) { |
| 15020 | 15068 | return string; |
@@ -1,7 +1,7 @@ | ||
| 1 | 1 | var root = require('./_root'), |
| 2 | 2 | toString = require('./toString'); |
| 3 | 3 | |
| 4 | /** Used to match leading and trailing whitespace. */ | |
| 4 | /** Used to match leading whitespace. */ | |
| 5 | 5 | var reTrimStart = /^\s+/; |
| 6 | 6 | |
| 7 | 7 | /* Built-in method references for those with the same name as other `lodash` methods. */ |
@@ -10,12 +10,27 @@ | ||
| 10 | 10 | templateSettings = require('./templateSettings'), |
| 11 | 11 | toString = require('./toString'); |
| 12 | 12 | |
| 13 | /** Error message constants. */ | |
| 14 | var INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`'; | |
| 15 | ||
| 13 | 16 | /** Used to match empty string literals in compiled template source. */ |
| 14 | 17 | var reEmptyStringLeading = /\b__p \+= '';/g, |
| 15 | 18 | reEmptyStringMiddle = /\b(__p \+=) '' \+/g, |
| 16 | 19 | reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; |
| 17 | 20 | |
| 18 | 21 | /** |
| 22 | * Used to validate the `validate` option in `_.template` variable. | |
| 23 | * | |
| 24 | * Forbids characters which could potentially change the meaning of the function argument definition: | |
| 25 | * - "()," (modification of function parameters) | |
| 26 | * - "=" (default value) | |
| 27 | * - "[]{}" (destructuring of function parameters) | |
| 28 | * - "/" (beginning of a comment) | |
| 29 | * - whitespace | |
| 30 | */ | |
| 31 | var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; | |
| 32 | ||
| 33 | /** | |
| 19 | 34 | * Used to match |
| 20 | 35 | * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). |
| 21 | 36 | */ |
@@ -210,6 +225,12 @@ | ||
| 210 | 225 | if (!variable) { |
| 211 | 226 | source = 'with (obj) {\n' + source + '\n}\n'; |
| 212 | 227 | } |
| 228 | // Throw an error if a forbidden character was found in `variable`, to prevent | |
| 229 | // potential command injection attacks. | |
| 230 | else if (reForbiddenIdentifierChars.test(variable)) { | |
| 231 | throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT); | |
| 232 | } | |
| 233 | ||
| 213 | 234 | // Cleanup code by stripping empty strings. |
| 214 | 235 | source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source) |
| 215 | 236 | .replace(reEmptyStringMiddle, '$1') |
@@ -1,12 +1,10 @@ | ||
| 1 | var isObject = require('./isObject'), | |
| 1 | var baseTrim = require('./_baseTrim'), | |
| 2 | isObject = require('./isObject'), | |
| 2 | 3 | isSymbol = require('./isSymbol'); |
| 3 | 4 | |
| 4 | 5 | /** Used as references for various `Number` constants. */ |
| 5 | 6 | var NAN = 0 / 0; |
| 6 | 7 | |
| 7 | /** Used to match leading and trailing whitespace. */ | |
| 8 | var reTrim = /^\s+|\s+$/g; | |
| 9 | ||
| 10 | 8 | /** Used to detect bad signed hexadecimal string values. */ |
| 11 | 9 | var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; |
| 12 | 10 | |
@@ -56,7 +54,7 @@ | ||
| 56 | 54 | if (typeof value != 'string') { |
| 57 | 55 | return value === 0 ? value : +value; |
| 58 | 56 | } |
| 59 | value = value.replace(reTrim, ''); | |
| 57 | value = baseTrim(value); | |
| 60 | 58 | var isBinary = reIsBinary.test(value); |
| 61 | 59 | return (isBinary || reIsOctal.test(value)) |
| 62 | 60 | ? freeParseInt(value.slice(2), isBinary ? 2 : 8) |
@@ -1,13 +1,11 @@ | ||
| 1 | 1 | var baseToString = require('./_baseToString'), |
| 2 | baseTrim = require('./_baseTrim'), | |
| 2 | 3 | castSlice = require('./_castSlice'), |
| 3 | 4 | charsEndIndex = require('./_charsEndIndex'), |
| 4 | 5 | charsStartIndex = require('./_charsStartIndex'), |
| 5 | 6 | stringToArray = require('./_stringToArray'), |
| 6 | 7 | toString = require('./toString'); |
| 7 | 8 | |
| 8 | /** Used to match leading and trailing whitespace. */ | |
| 9 | var reTrim = /^\s+|\s+$/g; | |
| 10 | ||
| 11 | 9 | /** |
| 12 | 10 | * Removes leading and trailing whitespace or specified characters from `string`. |
| 13 | 11 | * |
@@ -33,7 +31,7 @@ | ||
| 33 | 31 | function trim(string, chars, guard) { |
| 34 | 32 | string = toString(string); |
| 35 | 33 | if (string && (guard || chars === undefined)) { |
| 36 | return string.replace(reTrim, ''); | |
| 34 | return baseTrim(string); | |
| 37 | 35 | } |
| 38 | 36 | if (!string || !(chars = baseToString(chars))) { |
| 39 | 37 | return string; |
@@ -2,11 +2,9 @@ | ||
| 2 | 2 | castSlice = require('./_castSlice'), |
| 3 | 3 | charsEndIndex = require('./_charsEndIndex'), |
| 4 | 4 | stringToArray = require('./_stringToArray'), |
| 5 | toString = require('./toString'); | |
| 5 | toString = require('./toString'), | |
| 6 | trimmedEndIndex = require('./_trimmedEndIndex'); | |
| 6 | 7 | |
| 7 | /** Used to match leading and trailing whitespace. */ | |
| 8 | var reTrimEnd = /\s+$/; | |
| 9 | ||
| 10 | 8 | /** |
| 11 | 9 | * Removes trailing whitespace or specified characters from `string`. |
| 12 | 10 | * |
@@ -29,7 +27,7 @@ | ||
| 29 | 27 | function trimEnd(string, chars, guard) { |
| 30 | 28 | string = toString(string); |
| 31 | 29 | if (string && (guard || chars === undefined)) { |
| 32 | return string.replace(reTrimEnd, ''); | |
| 30 | return string.slice(0, trimmedEndIndex(string) + 1); | |
| 33 | 31 | } |
| 34 | 32 | if (!string || !(chars = baseToString(chars))) { |
| 35 | 33 | return string; |
@@ -1,4 +1,4 @@ | ||
| 1 | # lodash v4.17.20 | |
| 1 | # lodash v4.17.21 | |
| 2 | 2 | |
| 3 | 3 | The [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules. |
| 4 | 4 | |
@@ -28,7 +28,7 @@ | ||
| 28 | 28 | var curryN = require('lodash/fp/curryN'); |
| 29 | 29 | ``` |
| 30 | 30 | |
| 31 | See the [package source](https://github.com/lodash/lodash/tree/4.17.20-npm) for more details. | |
| 31 | See the [package source](https://github.com/lodash/lodash/tree/4.17.21-npm) for more details. | |
| 32 | 32 | |
| 33 | 33 | **Note:**<br> |
| 34 | 34 | Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL. |
@@ -0,0 +1,19 @@ | ||
| 1 | var trimmedEndIndex = require('./_trimmedEndIndex'); | |
| 2 | ||
| 3 | /** Used to match leading whitespace. */ | |
| 4 | var reTrimStart = /^\s+/; | |
| 5 | ||
| 6 | /** | |
| 7 | * The base implementation of `_.trim`. | |
| 8 | * | |
| 9 | * @private | |
| 10 | * @param {string} string The string to trim. | |
| 11 | * @returns {string} Returns the trimmed string. | |
| 12 | */ | |
| 13 | function baseTrim(string) { | |
| 14 | return string | |
| 15 | ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') | |
| 16 | : string; | |
| 17 | } | |
| 18 | ||
| 19 | module.exports = baseTrim; | |
@@ -0,0 +1,19 @@ | ||
| 1 | /** Used to match a single whitespace character. */ | |
| 2 | var reWhitespace = /\s/; | |
| 3 | ||
| 4 | /** | |
| 5 | * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace | |
| 6 | * character of `string`. | |
| 7 | * | |
| 8 | * @private | |
| 9 | * @param {string} string The string to inspect. | |
| 10 | * @returns {number} Returns the index of the last non-whitespace character. | |
| 11 | */ | |
| 12 | function trimmedEndIndex(string) { | |
| 13 | var index = string.length; | |
| 14 | ||
| 15 | while (index-- && reWhitespace.test(string.charAt(index))) {} | |
| 16 | return index; | |
| 17 | } | |
| 18 | ||
| 19 | module.exports = trimmedEndIndex; | |
@@ -0,0 +1,40 @@ | ||
| 1 | { | |
| 2 | "nodes": { | |
| 3 | "nixpkgs": { | |
| 4 | "locked": { | |
| 5 | "lastModified": 1613582597, | |
| 6 | "narHash": "sha256-6LvipIvFuhyorHpUqK3HjySC5Y6gshXHFBhU9EJ4DoM=", | |
| 7 | "path": "/nix/store/srvplqq673sqd9vyfhyc5w1p88y1gfm4-source", | |
| 8 | "rev": "6b1057b452c55bb3b463f0d7055bc4ec3fd1f381", | |
| 9 | "type": "path" | |
| 10 | }, | |
| 11 | "original": { | |
| 12 | "id": "nixpkgs", | |
| 13 | "type": "indirect" | |
| 14 | } | |
| 15 | }, | |
| 16 | "root": { | |
| 17 | "inputs": { | |
| 18 | "nixpkgs": "nixpkgs", | |
| 19 | "utils": "utils" | |
| 20 | } | |
| 21 | }, | |
| 22 | "utils": { | |
| 23 | "locked": { | |
| 24 | "lastModified": 1610051610, | |
| 25 | "narHash": "sha256-U9rPz/usA1/Aohhk7Cmc2gBrEEKRzcW4nwPWMPwja4Y=", | |
| 26 | "owner": "numtide", | |
| 27 | "repo": "flake-utils", | |
| 28 | "rev": "3982c9903e93927c2164caa727cd3f6a0e6d14cc", | |
| 29 | "type": "github" | |
| 30 | }, | |
| 31 | "original": { | |
| 32 | "owner": "numtide", | |
| 33 | "repo": "flake-utils", | |
| 34 | "type": "github" | |
| 35 | } | |
| 36 | } | |
| 37 | }, | |
| 38 | "root": "root", | |
| 39 | "version": 7 | |
| 40 | } | |
@@ -0,0 +1,48 @@ | ||
| 1 | npm run build | |
| 2 | npm run doc | |
| 3 | npm i | |
| 4 | git clone --depth=10 --branch=master git@github.com:lodash-archive/lodash-cli.git ./node_modules/lodash-cli | |
| 5 | mkdir -p ./node_modules/lodash-cli/node_modules/lodash; cd $_; cp ../../../../lodash.js ./lodash.js; cp ../../../../package.json ./package.json | |
| 6 | cd ../../; npm i --production; cd ../../ | |
| 7 | node ./node_modules/lodash-cli/bin/lodash core exports=node -o ./npm-package/core.js | |
| 8 | node ./node_modules/lodash-cli/bin/lodash modularize exports=node -o ./npm-package | |
| 9 | cp lodash.js npm-package/lodash.js | |
| 10 | cp dist/lodash.min.js npm-package/lodash.min.js | |
| 11 | cp LICENSE npm-package/LICENSE | |
| 12 | ||
| 13 | 1. Clone two repos | |
| 14 | Bump lodash version in package.json, readme, package=locak, lodash.js | |
| 15 | npm run build | |
| 16 | npm run doc | |
| 17 | ||
| 18 | 2. update mappings in ldoash-cli | |
| 19 | 3. copy ldoash into lodash-cli node modules and package json. | |
| 20 | ||
| 21 | node ./node_modules/lodash-cli/bin/lodash core exports=node -o ./npm-package/core.js | |
| 22 | node ./node_modules/lodash-cli/bin/lodash modularize exports=node -o ./npm-package | |
| 23 | ||
| 24 | ||
| 25 | ||
| 26 | 1. Clone the two repositories: | |
| 27 | ```sh | |
| 28 | $ git clone https://github.com/lodash/lodash.git | |
| 29 | $ git clone https://github.com/bnjmnt4n/lodash-cli.git | |
| 30 | ``` | |
| 31 | 2. Update lodash-cli to accomdate changes in lodash source. This can typically involve adding new function dependency mappings in lib/mappings.js. Sometimes, additional changes might be needed for more involved functions. | |
| 32 | 3. In the lodash repository, update references to the lodash version in README.md, lodash.js, package.jsona nd package-lock.json | |
| 33 | 4. Run: | |
| 34 | ```sh | |
| 35 | npm run build | |
| 36 | npm run doc | |
| 37 | node ../lodash-cli/bin/lodash core -o ./dist/lodash.core.js | |
| 38 | ``` | |
| 39 | 5. Add a commit and tag the release | |
| 40 | mkdir ../lodash-temp | |
| 41 | cp lodash.js dist/lodash.min.js dist/lodash.core.js dist/lodash.core.min.js ../lodash-temp/ | |
| 42 | node ../lodash-cli/bin/lodash modularize exports=node -o . | |
| 43 | cp ../lodash-temp/lodash.core.js core.js | |
| 44 | cp ../lodash-temp/lodash.core.min.js core.min.js | |
| 45 | cp ../lodash-temp/lodash.js lodash.js | |
| 46 | cp ../lodash-temp/lodash.min.js lodash.min.js | |
| 47 | ||
| 48 | ❯ node ../lodash-cli/bin/lodash modularize exports=es -o . | |
@@ -0,0 +1,20 @@ | ||
| 1 | { | |
| 2 | inputs = { | |
| 3 | utils.url = "github:numtide/flake-utils"; | |
| 4 | }; | |
| 5 | ||
| 6 | outputs = { self, nixpkgs, utils }: | |
| 7 | utils.lib.eachDefaultSystem (system: | |
| 8 | let | |
| 9 | pkgs = nixpkgs.legacyPackages."${system}"; | |
| 10 | in rec { | |
| 11 | devShell = pkgs.mkShell { | |
| 12 | nativeBuildInputs = with pkgs; [ | |
| 13 | yarn | |
| 14 | nodejs-14_x | |
| 15 | nodePackages.typescript-language-server | |
| 16 | nodePackages.eslint | |
| 17 | ]; | |
| 18 | }; | |
| 19 | }); | |
| 20 | } | |