...**/!(*.map|*.min.js)Size
Gzip
Dependencies
Publish
Install
Publish
Install
@@ -18,7 +18,8 @@ | |||
| 18 | isMap = require('./isMap'), | 18 | isMap = require('./isMap'), |
| 19 | isObject = require('./isObject'), | 19 | isObject = require('./isObject'), |
| 20 | isSet = require('./isSet'), | 20 | isSet = require('./isSet'), |
| 21 | keys = require('./keys'); | 21 | keys = require('./keys'), |
| 22 | keysIn = require('./keysIn'); | ||
| 22 | 23 | ||
| 23 | /** Used to compose bitmasks for cloning. */ | 24 | /** Used to compose bitmasks for cloning. */ |
| 24 | var CLONE_DEEP_FLAG = 1, | 25 | var CLONE_DEEP_FLAG = 1, |
@@ -1,10 +1,12 @@ | |||
| 1 | var arrayMap = require('./_arrayMap'), | 1 | var arrayMap = require('./_arrayMap'), |
| 2 | baseGet = require('./_baseGet'), | ||
| 2 | baseIteratee = require('./_baseIteratee'), | 3 | baseIteratee = require('./_baseIteratee'), |
| 3 | baseMap = require('./_baseMap'), | 4 | baseMap = require('./_baseMap'), |
| 4 | baseSortBy = require('./_baseSortBy'), | 5 | baseSortBy = require('./_baseSortBy'), |
| 5 | baseUnary = require('./_baseUnary'), | 6 | baseUnary = require('./_baseUnary'), |
| 6 | compareMultiple = require('./_compareMultiple'), | 7 | compareMultiple = require('./_compareMultiple'), |
| 7 | identity = require('./identity'); | 8 | identity = require('./identity'), |
| 9 | isArray = require('./isArray'); | ||
| 8 | 10 | ||
| 9 | /** | 11 | /** |
| 10 | * The base implementation of `_.orderBy` without param guards. | 12 | * The base implementation of `_.orderBy` without param guards. |
@@ -16,8 +18,21 @@ | |||
| 16 | * @returns {Array} Returns the new sorted array. | 18 | * @returns {Array} Returns the new sorted array. |
| 17 | */ | 19 | */ |
| 18 | function baseOrderBy(collection, iteratees, orders) { | 20 | function baseOrderBy(collection, iteratees, orders) { |
| 21 | if (iteratees.length) { | ||
| 22 | iteratees = arrayMap(iteratees, function(iteratee) { | ||
| 23 | if (isArray(iteratee)) { | ||
| 24 | return function(value) { | ||
| 25 | return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); | ||
| 26 | } | ||
| 27 | } | ||
| 28 | return iteratee; | ||
| 29 | }); | ||
| 30 | } else { | ||
| 31 | iteratees = [identity]; | ||
| 32 | } | ||
| 33 | |||
| 19 | var index = -1; | 34 | var index = -1; |
| 20 | iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee)); | 35 | iteratees = arrayMap(iteratees, baseUnary(baseIteratee)); |
| 21 | 36 | ||
| 22 | var result = baseMap(collection, function(value, key, collection) { | 37 | var result = baseMap(collection, function(value, key, collection) { |
| 23 | var criteria = arrayMap(iteratees, function(iteratee) { | 38 | var criteria = arrayMap(iteratees, function(iteratee) { |
@@ -29,6 +29,10 @@ | |||
| 29 | var key = toKey(path[index]), | 29 | var key = toKey(path[index]), |
| 30 | newValue = value; | 30 | newValue = value; |
| 31 | 31 | ||
| 32 | if (key === '__proto__' || key === 'constructor' || key === 'prototype') { | ||
| 33 | return object; | ||
| 34 | } | ||
| 35 | |||
| 32 | if (index != lastIndex) { | 36 | if (index != lastIndex) { |
| 33 | var objValue = nested[key]; | 37 | var objValue = nested[key]; |
| 34 | newValue = customizer ? customizer(objValue, key, nested) : undefined; | 38 | newValue = customizer ? customizer(objValue, key, nested) : undefined; |
@@ -22,11 +22,14 @@ | |||
| 22 | * into `array`. | 22 | * into `array`. |
| 23 | */ | 23 | */ |
| 24 | function baseSortedIndexBy(array, value, iteratee, retHighest) { | 24 | function baseSortedIndexBy(array, value, iteratee, retHighest) { |
| 25 | var low = 0, | ||
| 26 | high = array == null ? 0 : array.length; | ||
| 27 | if (high === 0) { | ||
| 28 | return 0; | ||
| 29 | } | ||
| 30 | |||
| 25 | value = iteratee(value); | 31 | value = iteratee(value); |
| 26 | |||
| 27 | var low = 0, | ||
| 28 | high = array == null ? 0 : array.length, | ||
| 29 | valIsNaN = value !== value, | 32 | var valIsNaN = value !== value, |
| 30 | valIsNull = value === null, | 33 | valIsNull = value === null, |
| 31 | valIsSymbol = isSymbol(value), | 34 | valIsSymbol = isSymbol(value), |
| 32 | valIsUndefined = value === undefined; | 35 | valIsUndefined = value === undefined; |
@@ -27,10 +27,11 @@ | |||
| 27 | if (arrLength != othLength && !(isPartial && othLength > arrLength)) { | 27 | if (arrLength != othLength && !(isPartial && othLength > arrLength)) { |
| 28 | return false; | 28 | return false; |
| 29 | } | 29 | } |
| 30 | // Assume cyclic values are equal. | ||
| 31 | var stacked = stack.get(array); | ||
| 32 | if (stacked && stack.get(other)) { | ||
| 33 | return stacked == other; | 30 | // Check that cyclic values are equal. |
| 31 | var arrStacked = stack.get(array); | ||
| 32 | var othStacked = stack.get(other); | ||
| 33 | if (arrStacked && othStacked) { | ||
| 34 | return arrStacked == other && othStacked == array; | ||
| 34 | } | 35 | } |
| 35 | var index = -1, | 36 | var index = -1, |
| 36 | result = true, | 37 | result = true, |
@@ -39,10 +39,11 @@ | |||
| 39 | return false; | 39 | return false; |
| 40 | } | 40 | } |
| 41 | } | 41 | } |
| 42 | // Assume cyclic values are equal. | ||
| 43 | var stacked = stack.get(object); | ||
| 44 | if (stacked && stack.get(other)) { | ||
| 45 | return stacked == other; | 42 | // Check that cyclic values are equal. |
| 43 | var objStacked = stack.get(object); | ||
| 44 | var othStacked = stack.get(other); | ||
| 45 | if (objStacked && othStacked) { | ||
| 46 | return objStacked == other && othStacked == object; | ||
| 46 | } | 47 | } |
| 47 | var result = true; | 48 | var result = true; |
| 48 | stack.set(object, other); | 49 | stack.set(object, other); |
@@ -1,7 +1,7 @@ | |||
| 1 | /** | 1 | /** |
| 2 | * @license | 2 | * @license |
| 3 | * Lodash (Custom Build) <https://lodash.com/> | 3 | * Lodash (Custom Build) <https://lodash.com/> |
| 4 | * Build: `lodash core exports="node" -o ./npm-package/core.js` | 4 | * Build: `lodash core -o ./dist/lodash.core.js` |
| 5 | * Copyright OpenJS Foundation and other contributors <https://openjsf.org/> | 5 | * Copyright OpenJS Foundation and other contributors <https://openjsf.org/> |
| 6 | * Released under MIT license <https://lodash.com/license> | 6 | * Released under MIT license <https://lodash.com/license> |
| 7 | * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | 7 | * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> |
@@ -13,7 +13,7 @@ | |||
| 13 | var undefined; | 13 | var undefined; |
| 14 | 14 | ||
| 15 | /** Used as the semantic version number. */ | 15 | /** Used as the semantic version number. */ |
| 16 | var VERSION = '4.17.15'; | 16 | var VERSION = '4.17.20'; |
| 17 | 17 | ||
| 18 | /** Error message constants. */ | 18 | /** Error message constants. */ |
| 19 | var FUNC_ERROR_TEXT = 'Expected a function'; | 19 | var FUNC_ERROR_TEXT = 'Expected a function'; |
@@ -1183,6 +1183,12 @@ | |||
| 1183 | if (arrLength != othLength && !(isPartial && othLength > arrLength)) { | 1183 | if (arrLength != othLength && !(isPartial && othLength > arrLength)) { |
| 1184 | return false; | 1184 | return false; |
| 1185 | } | 1185 | } |
| 1186 | // Check that cyclic values are equal. | ||
| 1187 | var arrStacked = stack.get(array); | ||
| 1188 | var othStacked = stack.get(other); | ||
| 1189 | if (arrStacked && othStacked) { | ||
| 1190 | return arrStacked == other && othStacked == array; | ||
| 1191 | } | ||
| 1186 | var index = -1, | 1192 | var index = -1, |
| 1187 | result = true, | 1193 | result = true, |
| 1188 | seen = (bitmask & COMPARE_UNORDERED_FLAG) ? [] : undefined; | 1194 | seen = (bitmask & COMPARE_UNORDERED_FLAG) ? [] : undefined; |
@@ -1293,6 +1299,12 @@ | |||
| 1293 | return false; | 1299 | return false; |
| 1294 | } | 1300 | } |
| 1295 | } | 1301 | } |
| 1302 | // Check that cyclic values are equal. | ||
| 1303 | var objStacked = stack.get(object); | ||
| 1304 | var othStacked = stack.get(other); | ||
| 1305 | if (objStacked && othStacked) { | ||
| 1306 | return objStacked == other && othStacked == object; | ||
| 1307 | } | ||
| 1296 | var result = true; | 1308 | var result = true; |
| 1297 | 1309 | ||
| 1298 | var skipCtor = isPartial; | 1310 | var skipCtor = isPartial; |
@@ -1935,6 +1947,10 @@ | |||
| 1935 | * // The `_.property` iteratee shorthand. | 1947 | * // The `_.property` iteratee shorthand. |
| 1936 | * _.filter(users, 'active'); | 1948 | * _.filter(users, 'active'); |
| 1937 | * // => objects for ['barney'] | 1949 | * // => objects for ['barney'] |
| 1950 | * | ||
| 1951 | * // Combining several predicates using `_.overEvery` or `_.overSome`. | ||
| 1952 | * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); | ||
| 1953 | * // => objects for ['fred', 'barney'] | ||
| 1938 | */ | 1954 | */ |
| 1939 | function filter(collection, predicate) { | 1955 | function filter(collection, predicate) { |
| 1940 | return baseFilter(collection, baseIteratee(predicate)); | 1956 | return baseFilter(collection, baseIteratee(predicate)); |
@@ -2188,15 +2204,15 @@ | |||
| 2188 | * var users = [ | 2204 | * var users = [ |
| 2189 | * { 'user': 'fred', 'age': 48 }, | 2205 | * { 'user': 'fred', 'age': 48 }, |
| 2190 | * { 'user': 'barney', 'age': 36 }, | 2206 | * { 'user': 'barney', 'age': 36 }, |
| 2191 | * { 'user': 'fred', 'age': 40 }, | 2207 | * { 'user': 'fred', 'age': 30 }, |
| 2192 | * { 'user': 'barney', 'age': 34 } | 2208 | * { 'user': 'barney', 'age': 34 } |
| 2193 | * ]; | 2209 | * ]; |
| 2194 | * | 2210 | * |
| 2195 | * _.sortBy(users, [function(o) { return o.user; }]); | 2211 | * _.sortBy(users, [function(o) { return o.user; }]); |
| 2196 | * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] | 2212 | * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] |
| 2197 | * | 2213 | * |
| 2198 | * _.sortBy(users, ['user', 'age']); | 2214 | * _.sortBy(users, ['user', 'age']); |
| 2199 | * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] | 2215 | * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] |
| 2200 | */ | 2216 | */ |
| 2201 | function sortBy(collection, iteratee) { | 2217 | function sortBy(collection, iteratee) { |
| 2202 | var index = 0; | 2218 | var index = 0; |
@@ -3503,6 +3519,9 @@ | |||
| 3503 | * values against any array or object value, respectively. See `_.isEqual` | 3519 | * values against any array or object value, respectively. See `_.isEqual` |
| 3504 | * for a list of supported value comparisons. | 3520 | * for a list of supported value comparisons. |
| 3505 | * | 3521 | * |
| 3522 | * **Note:** Multiple values can be checked by combining several matchers | ||
| 3523 | * using `_.overSome` | ||
| 3524 | * | ||
| 3506 | * @static | 3525 | * @static |
| 3507 | * @memberOf _ | 3526 | * @memberOf _ |
| 3508 | * @since 3.0.0 | 3527 | * @since 3.0.0 |
@@ -3518,6 +3537,10 @@ | |||
| 3518 | * | 3537 | * |
| 3519 | * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); | 3538 | * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); |
| 3520 | * // => [{ 'a': 4, 'b': 5, 'c': 6 }] | 3539 | * // => [{ 'a': 4, 'b': 5, 'c': 6 }] |
| 3540 | * | ||
| 3541 | * // Checking for several possible values | ||
| 3542 | * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); | ||
| 3543 | * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] | ||
| 3521 | */ | 3544 | */ |
| 3522 | function matches(source) { | 3545 | function matches(source) { |
| 3523 | return baseMatches(assign({}, source)); | 3546 | return baseMatches(assign({}, source)); |
@@ -3826,10 +3849,29 @@ | |||
| 3826 | 3849 | ||
| 3827 | /*--------------------------------------------------------------------------*/ | 3850 | /*--------------------------------------------------------------------------*/ |
| 3828 | 3851 | ||
| 3829 | if (freeModule) { | 3852 | // Some AMD build optimizers, like r.js, check for condition patterns like: |
| 3853 | if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { | ||
| 3854 | // Expose Lodash on the global object to prevent errors when Lodash is | ||
| 3855 | // loaded by a script tag in the presence of an AMD loader. | ||
| 3856 | // See http://requirejs.org/docs/errors.html#mismatch for more details. | ||
| 3857 | // Use `_.noConflict` to remove Lodash from the global object. | ||
| 3858 | root._ = lodash; | ||
| 3859 | |||
| 3860 | // Define as an anonymous module so, through path mapping, it can be | ||
| 3861 | // referenced as the "underscore" module. | ||
| 3862 | define(function() { | ||
| 3863 | return lodash; | ||
| 3864 | }); | ||
| 3865 | } | ||
| 3866 | // Check for `exports` after `define` in case a build optimizer adds it. | ||
| 3867 | else if (freeModule) { | ||
| 3830 | // Export for Node.js. | 3868 | // Export for Node.js. |
| 3831 | (freeModule.exports = lodash)._ = lodash; | 3869 | (freeModule.exports = lodash)._ = lodash; |
| 3832 | // Export for CommonJS support. | 3870 | // Export for CommonJS support. |
| 3833 | freeExports._ = lodash; | 3871 | freeExports._ = lodash; |
| 3834 | } | 3872 | } |
| 3873 | else { | ||
| 3874 | // Export to the global object. | ||
| 3875 | root._ = lodash; | ||
| 3876 | } | ||
| 3835 | }.call(this)); | 3877 | }.call(this)); |
@@ -39,6 +39,10 @@ | |||
| 39 | * // The `_.property` iteratee shorthand. | 39 | * // The `_.property` iteratee shorthand. |
| 40 | * _.filter(users, 'active'); | 40 | * _.filter(users, 'active'); |
| 41 | * // => objects for ['barney'] | 41 | * // => objects for ['barney'] |
| 42 | * | ||
| 43 | * // Combining several predicates using `_.overEvery` or `_.overSome`. | ||
| 44 | * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); | ||
| 45 | * // => objects for ['fred', 'barney'] | ||
| 42 | */ | 46 | */ |
| 43 | function filter(collection, predicate) { | 47 | function filter(collection, predicate) { |
| 44 | var func = isArray(collection) ? arrayFilter : baseFilter; | 48 | var func = isArray(collection) ? arrayFilter : baseFilter; |
@@ -12,7 +12,7 @@ | |||
| 12 | var undefined; | 12 | var undefined; |
| 13 | 13 | ||
| 14 | /** Used as the semantic version number. */ | 14 | /** Used as the semantic version number. */ |
| 15 | var VERSION = '4.17.19'; | 15 | var VERSION = '4.17.20'; |
| 16 | 16 | ||
| 17 | /** Used as the size to enable large array optimizations. */ | 17 | /** Used as the size to enable large array optimizations. */ |
| 18 | var LARGE_ARRAY_SIZE = 200; | 18 | var LARGE_ARRAY_SIZE = 200; |
@@ -15588,7 +15588,7 @@ | |||
| 15588 | * // => [{ 'a': 4, 'b': 5, 'c': 6 }] | 15588 | * // => [{ 'a': 4, 'b': 5, 'c': 6 }] |
| 15589 | * | 15589 | * |
| 15590 | * // Checking for several possible values | 15590 | * // Checking for several possible values |
| 15591 | * _.filter(users, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); | 15591 | * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); |
| 15592 | * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] | 15592 | * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] |
| 15593 | */ | 15593 | */ |
| 15594 | function matches(source) { | 15594 | function matches(source) { |
@@ -15625,7 +15625,7 @@ | |||
| 15625 | * // => { 'a': 4, 'b': 5, 'c': 6 } | 15625 | * // => { 'a': 4, 'b': 5, 'c': 6 } |
| 15626 | * | 15626 | * |
| 15627 | * // Checking for several possible values | 15627 | * // Checking for several possible values |
| 15628 | * _.filter(users, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)])); | 15628 | * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)])); |
| 15629 | * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] | 15629 | * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] |
| 15630 | */ | 15630 | */ |
| 15631 | function matchesProperty(path, srcValue) { | 15631 | function matchesProperty(path, srcValue) { |
@@ -16,6 +16,9 @@ | |||
| 16 | * values against any array or object value, respectively. See `_.isEqual` | 16 | * values against any array or object value, respectively. See `_.isEqual` |
| 17 | * for a list of supported value comparisons. | 17 | * for a list of supported value comparisons. |
| 18 | * | 18 | * |
| 19 | * **Note:** Multiple values can be checked by combining several matchers | ||
| 20 | * using `_.overSome` | ||
| 21 | * | ||
| 19 | * @static | 22 | * @static |
| 20 | * @memberOf _ | 23 | * @memberOf _ |
| 21 | * @since 3.0.0 | 24 | * @since 3.0.0 |
@@ -31,6 +34,10 @@ | |||
| 31 | * | 34 | * |
| 32 | * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); | 35 | * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); |
| 33 | * // => [{ 'a': 4, 'b': 5, 'c': 6 }] | 36 | * // => [{ 'a': 4, 'b': 5, 'c': 6 }] |
| 37 | * | ||
| 38 | * // Checking for several possible values | ||
| 39 | * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); | ||
| 40 | * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] | ||
| 34 | */ | 41 | */ |
| 35 | function matches(source) { | 42 | function matches(source) { |
| 36 | return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); | 43 | return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); |
@@ -13,6 +13,9 @@ | |||
| 13 | * `srcValue` values against any array or object value, respectively. See | 13 | * `srcValue` values against any array or object value, respectively. See |
| 14 | * `_.isEqual` for a list of supported value comparisons. | 14 | * `_.isEqual` for a list of supported value comparisons. |
| 15 | * | 15 | * |
| 16 | * **Note:** Multiple values can be checked by combining several matchers | ||
| 17 | * using `_.overSome` | ||
| 18 | * | ||
| 16 | * @static | 19 | * @static |
| 17 | * @memberOf _ | 20 | * @memberOf _ |
| 18 | * @since 3.2.0 | 21 | * @since 3.2.0 |
@@ -29,6 +32,10 @@ | |||
| 29 | * | 32 | * |
| 30 | * _.find(objects, _.matchesProperty('a', 4)); | 33 | * _.find(objects, _.matchesProperty('a', 4)); |
| 31 | * // => { 'a': 4, 'b': 5, 'c': 6 } | 34 | * // => { 'a': 4, 'b': 5, 'c': 6 } |
| 35 | * | ||
| 36 | * // Checking for several possible values | ||
| 37 | * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)])); | ||
| 38 | * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] | ||
| 32 | */ | 39 | */ |
| 33 | function matchesProperty(path, srcValue) { | 40 | function matchesProperty(path, srcValue) { |
| 34 | return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); | 41 | return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); |
@@ -5,6 +5,10 @@ | |||
| 5 | * Creates a function that checks if **all** of the `predicates` return | 5 | * Creates a function that checks if **all** of the `predicates` return |
| 6 | * truthy when invoked with the arguments it receives. | 6 | * truthy when invoked with the arguments it receives. |
| 7 | * | 7 | * |
| 8 | * Following shorthands are possible for providing predicates. | ||
| 9 | * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. | ||
| 10 | * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. | ||
| 11 | * | ||
| 8 | * @static | 12 | * @static |
| 9 | * @memberOf _ | 13 | * @memberOf _ |
| 10 | * @since 4.0.0 | 14 | * @since 4.0.0 |
@@ -5,6 +5,10 @@ | |||
| 5 | * Creates a function that checks if **any** of the `predicates` return | 5 | * Creates a function that checks if **any** of the `predicates` return |
| 6 | * truthy when invoked with the arguments it receives. | 6 | * truthy when invoked with the arguments it receives. |
| 7 | * | 7 | * |
| 8 | * Following shorthands are possible for providing predicates. | ||
| 9 | * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. | ||
| 10 | * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. | ||
| 11 | * | ||
| 8 | * @static | 12 | * @static |
| 9 | * @memberOf _ | 13 | * @memberOf _ |
| 10 | * @since 4.0.0 | 14 | * @since 4.0.0 |
@@ -24,6 +28,9 @@ | |||
| 24 | * | 28 | * |
| 25 | * func(NaN); | 29 | * func(NaN); |
| 26 | * // => false | 30 | * // => false |
| 31 | * | ||
| 32 | * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }]) | ||
| 33 | * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]]) | ||
| 27 | */ | 34 | */ |
| 28 | var overSome = createOver(arraySome); | 35 | var overSome = createOver(arraySome); |
| 29 | 36 | ||
@@ -22,15 +22,15 @@ | |||
| 22 | * var users = [ | 22 | * var users = [ |
| 23 | * { 'user': 'fred', 'age': 48 }, | 23 | * { 'user': 'fred', 'age': 48 }, |
| 24 | * { 'user': 'barney', 'age': 36 }, | 24 | * { 'user': 'barney', 'age': 36 }, |
| 25 | * { 'user': 'fred', 'age': 40 }, | 25 | * { 'user': 'fred', 'age': 30 }, |
| 26 | * { 'user': 'barney', 'age': 34 } | 26 | * { 'user': 'barney', 'age': 34 } |
| 27 | * ]; | 27 | * ]; |
| 28 | * | 28 | * |
| 29 | * _.sortBy(users, [function(o) { return o.user; }]); | 29 | * _.sortBy(users, [function(o) { return o.user; }]); |
| 30 | * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] | 30 | * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] |
| 31 | * | 31 | * |
| 32 | * _.sortBy(users, ['user', 'age']); | 32 | * _.sortBy(users, ['user', 'age']); |
| 33 | * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] | 33 | * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] |
| 34 | */ | 34 | */ |
| 35 | var sortBy = baseRest(function(collection, iteratees) { | 35 | var sortBy = baseRest(function(collection, iteratees) { |
| 36 | if (collection == null) { | 36 | if (collection == null) { |
@@ -169,11 +169,11 @@ | |||
| 169 | 169 | ||
| 170 | // Use a sourceURL for easier debugging. | 170 | // Use a sourceURL for easier debugging. |
| 171 | // The sourceURL gets injected into the source that's eval-ed, so be careful | 171 | // The sourceURL gets injected into the source that's eval-ed, so be careful |
| 172 | // with lookup (in case of e.g. prototype pollution), and strip newlines if any. | ||
| 173 | // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection. | 172 | // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in |
| 173 | // and escape the comment, thus injecting code that gets evaled. | ||
| 174 | var sourceURL = hasOwnProperty.call(options, 'sourceURL') | 174 | var sourceURL = hasOwnProperty.call(options, 'sourceURL') |
| 175 | ? ('//# sourceURL=' + | 175 | ? ('//# sourceURL=' + |
| 176 | (options.sourceURL + '').replace(/[\r\n]/g, ' ') + | 176 | (options.sourceURL + '').replace(/\s/g, ' ') + |
| 177 | '\n') | 177 | '\n') |
| 178 | : ''; | 178 | : ''; |
| 179 | 179 | ||
@@ -206,8 +206,6 @@ | |||
| 206 | 206 | ||
| 207 | // If `variable` is not specified wrap a with-statement around the generated | 207 | // If `variable` is not specified wrap a with-statement around the generated |
| 208 | // code to add the data object to the top of the scope chain. | 208 | // code to add the data object to the top of the scope chain. |
| 209 | // Like with sourceURL, we take care to not check the option's prototype, | ||
| 210 | // as this configuration is a code injection vector. | ||
| 211 | var variable = hasOwnProperty.call(options, 'variable') && options.variable; | 209 | var variable = hasOwnProperty.call(options, 'variable') && options.variable; |
| 212 | if (!variable) { | 210 | if (!variable) { |
| 213 | source = 'with (obj) {\n' + source + '\n}\n'; | 211 | source = 'with (obj) {\n' + source + '\n}\n'; |
@@ -1,6 +1,6 @@ | |||
| 1 | { | 1 | { |
| 2 | "name": "lodash", | 2 | "name": "lodash", |
| 3 | "version": "4.17.19", | 3 | "version": "4.17.20", |
| 4 | "description": "Lodash modular utilities.", | 4 | "description": "Lodash modular utilities.", |
| 5 | "keywords": "modules, stdlib, util", | 5 | "keywords": "modules, stdlib, util", |
| 6 | "homepage": "https://lodash.com/", | 6 | "homepage": "https://lodash.com/", |
@@ -1,4 +1,4 @@ | |||
| 1 | # lodash v4.17.19 | 1 | # lodash v4.17.20 |
| 2 | 2 | ||
| 3 | The [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules. | 3 | The [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules. |
| 4 | 4 | ||
@@ -28,7 +28,7 @@ | |||
| 28 | var curryN = require('lodash/fp/curryN'); | 28 | var curryN = require('lodash/fp/curryN'); |
| 29 | ``` | 29 | ``` |
| 30 | 30 | ||
| 31 | See the [package source](https://github.com/lodash/lodash/tree/4.17.19-npm) for more details. | 31 | See the [package source](https://github.com/lodash/lodash/tree/4.17.20-npm) for more details. |
| 32 | 32 | ||
| 33 | **Note:**<br> | 33 | **Note:**<br> |
| 34 | Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL. | 34 | Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL. |