Skip to content

Commit f299b52

Browse files
committed
Bump to v4.17.21
1 parent c4847eb commit f299b52

9 files changed

+543
-487
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# lodash v4.17.20
1+
# lodash v4.17.21
22

33
[Site](https://lodash.com/) |
44
[Docs](https://lodash.com/docs) |
@@ -20,11 +20,11 @@ $ lodash core -o ./dist/lodash.core.js
2020

2121
## Download
2222

23-
* [Core build](https://raw.githubusercontent.com/lodash/lodash/4.17.20/dist/lodash.core.js) ([~4 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.17.20/dist/lodash.core.min.js))
24-
* [Full build](https://raw.githubusercontent.com/lodash/lodash/4.17.20/dist/lodash.js) ([~24 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.17.20/dist/lodash.min.js))
23+
* [Core build](https://raw.githubusercontent.com/lodash/lodash/4.17.21/dist/lodash.core.js) ([~4 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.17.21/dist/lodash.core.min.js))
24+
* [Full build](https://raw.githubusercontent.com/lodash/lodash/4.17.21/dist/lodash.js) ([~24 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.17.21/dist/lodash.min.js))
2525
* [CDN copies](https://www.jsdelivr.com/projects/lodash)
2626

27-
Lodash is released under the [MIT license](https://raw.githubusercontent.com/lodash/lodash/4.17.20/LICENSE) & supports modern environments.<br>
27+
Lodash is released under the [MIT license](https://raw.githubusercontent.com/lodash/lodash/4.17.21/LICENSE) & supports modern environments.<br>
2828
Review the [build differences](https://github.com/lodash/lodash/wiki/build-differences) & pick one that’s right for you.
2929

3030
## Installation

dist/lodash.core.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
var undefined;
1414

1515
/** Used as the semantic version number. */
16-
var VERSION = '4.17.20';
16+
var VERSION = '4.17.21';
1717

1818
/** Error message constants. */
1919
var FUNC_ERROR_TEXT = 'Expected a function';

dist/lodash.core.min.js

+24-25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/lodash.js

+57-9
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
var undefined;
1313

1414
/** Used as the semantic version number. */
15-
var VERSION = '4.17.20';
15+
var VERSION = '4.17.21';
1616

1717
/** Used as the size to enable large array optimizations. */
1818
var LARGE_ARRAY_SIZE = 200;
1919

2020
/** Error message constants. */
2121
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`';
2324

2425
/** Used to stand-in for `undefined` hash values. */
2526
var HASH_UNDEFINED = '__lodash_hash_undefined__';
@@ -152,10 +153,11 @@
152153
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
153154
reHasRegExpChar = RegExp(reRegExpChar.source);
154155

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+/;
158+
159+
/** Used to match a single whitespace character. */
160+
var reWhitespace = /\s/;
159161

160162
/** Used to match wrap detail comments. */
161163
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
@@ -165,6 +167,18 @@
165167
/** Used to match words composed of alphanumeric characters. */
166168
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
167169

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+
168182
/** Used to match backslashes in property paths. */
169183
var reEscapeChar = /\\(\\)?/g;
170184

@@ -993,6 +1007,19 @@
9931007
});
9941008
}
9951009

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+
9961023
/**
9971024
* The base implementation of `_.unary` without support for storing metadata.
9981025
*
@@ -1326,6 +1353,21 @@
13261353
: asciiToArray(string);
13271354
}
13281355

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+
13291371
/**
13301372
* Used by `_.unescape` to convert HTML entities to characters.
13311373
*
@@ -12494,7 +12536,7 @@
1249412536
if (typeof value != 'string') {
1249512537
return value === 0 ? value : +value;
1249612538
}
12497-
value = value.replace(reTrim, '');
12539+
value = baseTrim(value);
1249812540
var isBinary = reIsBinary.test(value);
1249912541
return (isBinary || reIsOctal.test(value))
1250012542
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
@@ -14866,6 +14908,12 @@
1486614908
if (!variable) {
1486714909
source = 'with (obj) {\n' + source + '\n}\n';
1486814910
}
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+
1486914917
// Cleanup code by stripping empty strings.
1487014918
source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
1487114919
.replace(reEmptyStringMiddle, '$1')
@@ -14979,7 +15027,7 @@
1497915027
function trim(string, chars, guard) {
1498015028
string = toString(string);
1498115029
if (string && (guard || chars === undefined)) {
14982-
return string.replace(reTrim, '');
15030+
return baseTrim(string);
1498315031
}
1498415032
if (!string || !(chars = baseToString(chars))) {
1498515033
return string;
@@ -15014,7 +15062,7 @@
1501415062
function trimEnd(string, chars, guard) {
1501515063
string = toString(string);
1501615064
if (string && (guard || chars === undefined)) {
15017-
return string.replace(reTrimEnd, '');
15065+
return string.slice(0, trimmedEndIndex(string) + 1);
1501815066
}
1501915067
if (!string || !(chars = baseToString(chars))) {
1502015068
return string;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy