DEV: Update lodash from 4.17.15 to 4.17.21 (#13045)

We're dropping lodash from core after the next release, but until then let's keep it up to date.
This commit is contained in:
Jarek Radosz 2021-05-12 18:07:23 +02:00 committed by GitHub
parent f08f6118f2
commit 2cf063dc7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 79 additions and 27 deletions

View File

@ -7,6 +7,7 @@
"license": "GPL-2.0-only", "license": "GPL-2.0-only",
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "5.11.2", "@fortawesome/fontawesome-free": "5.11.2",
"@highlightjs/cdn-assets": "^10.6.0",
"@json-editor/json-editor": "^2.5.2", "@json-editor/json-editor": "^2.5.2",
"@popperjs/core": "v2.0.6", "@popperjs/core": "v2.0.6",
"ace-builds": "1.4.12", "ace-builds": "1.4.12",
@ -18,7 +19,6 @@
"diffhtml": "^1.0.0-beta.18", "diffhtml": "^1.0.0-beta.18",
"eslint-config-discourse": "^1.1.8", "eslint-config-discourse": "^1.1.8",
"handlebars": "^4.7.7", "handlebars": "^4.7.7",
"@highlightjs/cdn-assets": "^10.6.0",
"intersection-observer": "^0.5.1", "intersection-observer": "^0.5.1",
"jquery": "3.5.1", "jquery": "3.5.1",
"jquery-color": "3.0.0-alpha.1", "jquery-color": "3.0.0-alpha.1",
@ -41,8 +41,8 @@
"workbox-sw": "^4.3.1" "workbox-sw": "^4.3.1"
}, },
"devDependencies": { "devDependencies": {
"@mixer/parallel-prettier": "^2.0.1",
"@arkweid/lefthook": "^0.7.2", "@arkweid/lefthook": "^0.7.2",
"@mixer/parallel-prettier": "^2.0.1",
"chrome-launcher": "^0.12.0", "chrome-launcher": "^0.12.0",
"chrome-remote-interface": "^0.25", "chrome-remote-interface": "^0.25",
"lodash-cli": "https://github.com/lodash-archive/lodash-cli.git", "lodash-cli": "https://github.com/lodash-archive/lodash-cli.git",
@ -52,6 +52,9 @@
"route-recognizer": "^0.3.3", "route-recognizer": "^0.3.3",
"sinon": "^9.0.2" "sinon": "^9.0.2"
}, },
"resolutions": {
"lodash": "4.17.21"
},
"scripts": { "scripts": {
"preinstall": "node -e \"if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('NPM is not supported, please use Yarn instead. ')\"", "preinstall": "node -e \"if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('NPM is not supported, please use Yarn instead. ')\"",
"postinstall": "yarn --cwd app/assets/javascripts/discourse" "postinstall": "yarn --cwd app/assets/javascripts/discourse"

View File

@ -13,7 +13,7 @@
var undefined; var undefined;
/** Used as the semantic version number. */ /** Used as the semantic version number. */
var VERSION = '4.17.15'; var VERSION = '4.17.21';
/** Used as the size to enable large array optimizations. */ /** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200; var LARGE_ARRAY_SIZE = 200;
@ -127,8 +127,11 @@
*/ */
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to match leading and trailing whitespace. */ /** Used to match leading whitespace. */
var reTrim = /^\s+|\s+$/g; var reTrimStart = /^\s+/;
/** Used to match a single whitespace character. */
var reWhitespace = /\s/;
/** Used to match wrap detail comments. */ /** Used to match wrap detail comments. */
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
@ -628,6 +631,19 @@
return result; return result;
} }
/**
* The base implementation of `_.trim`.
*
* @private
* @param {string} string The string to trim.
* @returns {string} Returns the trimmed string.
*/
function baseTrim(string) {
return string
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
: string;
}
/** /**
* The base implementation of `_.unary` without support for storing metadata. * The base implementation of `_.unary` without support for storing metadata.
* *
@ -837,6 +853,21 @@
: asciiToArray(string); : asciiToArray(string);
} }
/**
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
* character of `string`.
*
* @private
* @param {string} string The string to inspect.
* @returns {number} Returns the index of the last non-whitespace character.
*/
function trimmedEndIndex(string) {
var index = string.length;
while (index-- && reWhitespace.test(string.charAt(index))) {}
return index;
}
/** /**
* Converts a Unicode `string` to an array. * Converts a Unicode `string` to an array.
* *
@ -2824,8 +2855,21 @@
* @returns {Array} Returns the new sorted array. * @returns {Array} Returns the new sorted array.
*/ */
function baseOrderBy(collection, iteratees, orders) { function baseOrderBy(collection, iteratees, orders) {
if (iteratees.length) {
iteratees = arrayMap(iteratees, function(iteratee) {
if (isArray(iteratee)) {
return function(value) {
return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
}
}
return iteratee;
});
} else {
iteratees = [identity];
}
var index = -1; var index = -1;
iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee())); iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
var result = baseMap(collection, function(value, key, collection) { var result = baseMap(collection, function(value, key, collection) {
var criteria = arrayMap(iteratees, function(iteratee) { var criteria = arrayMap(iteratees, function(iteratee) {
@ -2952,6 +2996,10 @@
var key = toKey(path[index]), var key = toKey(path[index]),
newValue = value; newValue = value;
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
return object;
}
if (index != lastIndex) { if (index != lastIndex) {
var objValue = nested[key]; var objValue = nested[key];
newValue = customizer ? customizer(objValue, key, nested) : undefined; newValue = customizer ? customizer(objValue, key, nested) : undefined;
@ -3826,10 +3874,11 @@
if (arrLength != othLength && !(isPartial && othLength > arrLength)) { if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false; return false;
} }
// Assume cyclic values are equal. // Check that cyclic values are equal.
var stacked = stack.get(array); var arrStacked = stack.get(array);
if (stacked && stack.get(other)) { var othStacked = stack.get(other);
return stacked == other; if (arrStacked && othStacked) {
return arrStacked == other && othStacked == array;
} }
var index = -1, var index = -1,
result = true, result = true,
@ -3991,10 +4040,11 @@
return false; return false;
} }
} }
// Assume cyclic values are equal. // Check that cyclic values are equal.
var stacked = stack.get(object); var objStacked = stack.get(object);
if (stacked && stack.get(other)) { var othStacked = stack.get(other);
return stacked == other; if (objStacked && othStacked) {
return objStacked == other && othStacked == object;
} }
var result = true; var result = true;
stack.set(object, other); stack.set(object, other);
@ -5596,6 +5646,10 @@
* // The `_.property` iteratee shorthand. * // The `_.property` iteratee shorthand.
* _.filter(users, 'active'); * _.filter(users, 'active');
* // => objects for ['barney'] * // => objects for ['barney']
*
* // Combining several predicates using `_.overEvery` or `_.overSome`.
* _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
* // => objects for ['fred', 'barney']
*/ */
function filter(collection, predicate) { function filter(collection, predicate) {
var func = isArray(collection) ? arrayFilter : baseFilter; var func = isArray(collection) ? arrayFilter : baseFilter;
@ -5855,15 +5909,15 @@
* var users = [ * var users = [
* { 'user': 'fred', 'age': 48 }, * { 'user': 'fred', 'age': 48 },
* { 'user': 'barney', 'age': 36 }, * { 'user': 'barney', 'age': 36 },
* { 'user': 'fred', 'age': 40 }, * { 'user': 'fred', 'age': 30 },
* { 'user': 'barney', 'age': 34 } * { 'user': 'barney', 'age': 34 }
* ]; * ];
* *
* _.sortBy(users, [function(o) { return o.user; }]); * _.sortBy(users, [function(o) { return o.user; }]);
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
* *
* _.sortBy(users, ['user', 'age']); * _.sortBy(users, ['user', 'age']);
* // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
*/ */
var sortBy = baseRest(function(collection, iteratees) { var sortBy = baseRest(function(collection, iteratees) {
if (collection == null) { if (collection == null) {
@ -6953,7 +7007,7 @@
if (typeof value != 'string') { if (typeof value != 'string') {
return value === 0 ? value : +value; return value === 0 ? value : +value;
} }
value = value.replace(reTrim, ''); value = baseTrim(value);
var isBinary = reIsBinary.test(value); var isBinary = reIsBinary.test(value);
return (isBinary || reIsOctal.test(value)) return (isBinary || reIsOctal.test(value))
? freeParseInt(value.slice(2), isBinary ? 2 : 8) ? freeParseInt(value.slice(2), isBinary ? 2 : 8)

View File

@ -2163,15 +2163,10 @@ lodash.get@^4.4.2:
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=
lodash@4.17.15: lodash@4.17.21, lodash@^4.17.14, lodash@^4.17.19:
version "4.17.15" version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
lodash@^4.17.14, lodash@^4.17.19:
version "4.17.20"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
log-symbols@^3.0.0: log-symbols@^3.0.0:
version "3.0.0" version "3.0.0"