...**/!(*.map|*.min.js)Size
Gzip
Dependencies
Publish
Install
Publish
Install
@@ -1,10 +1,12 @@ | ||
| 1 | 1 | var arrayMap = require('./_arrayMap'), |
| 2 | baseGet = require('./_baseGet'), | |
| 2 | 3 | baseIteratee = require('./_baseIteratee'), |
| 3 | 4 | baseMap = require('./_baseMap'), |
| 4 | 5 | baseSortBy = require('./_baseSortBy'), |
| 5 | 6 | baseUnary = require('./_baseUnary'), |
| 6 | 7 | compareMultiple = require('./_compareMultiple'), |
| 7 | identity = require('./identity'); | |
| 8 | identity = require('./identity'), | |
| 9 | isArray = require('./isArray'); | |
| 8 | 10 | |
| 9 | 11 | /** |
| 10 | 12 | * The base implementation of `_.orderBy` without param guards. |
@@ -16,8 +18,21 @@ | ||
| 16 | 18 | * @returns {Array} Returns the new sorted array. |
| 17 | 19 | */ |
| 18 | 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 | 34 | var index = -1; |
| 20 | iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee)); | |
| 35 | iteratees = arrayMap(iteratees, baseUnary(baseIteratee)); | |
| 21 | 36 | |
| 22 | 37 | var result = baseMap(collection, function(value, key, collection) { |
| 23 | 38 | var criteria = arrayMap(iteratees, function(iteratee) { |
@@ -29,6 +29,10 @@ | ||
| 29 | 29 | var key = toKey(path[index]), |
| 30 | 30 | newValue = value; |
| 31 | 31 | |
| 32 | if (key === '__proto__' || key === 'constructor' || key === 'prototype') { | |
| 33 | return object; | |
| 34 | } | |
| 35 | ||
| 32 | 36 | if (index != lastIndex) { |
| 33 | 37 | var objValue = nested[key]; |
| 34 | 38 | newValue = customizer ? customizer(objValue, key, nested) : undefined; |
@@ -22,11 +22,14 @@ | ||
| 22 | 22 | * into `array`. |
| 23 | 23 | */ |
| 24 | 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 | 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 | 33 | valIsNull = value === null, |
| 31 | 34 | valIsSymbol = isSymbol(value), |
| 32 | 35 | valIsUndefined = value === undefined; |
@@ -27,10 +27,11 @@ | ||
| 27 | 27 | if (arrLength != othLength && !(isPartial && othLength > arrLength)) { |
| 28 | 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 | 36 | var index = -1, |
| 36 | 37 | result = true, |
@@ -39,10 +39,11 @@ | ||
| 39 | 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 | 48 | var result = true; |
| 48 | 49 | stack.set(object, other); |
@@ -1,7 +1,7 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * @license |
| 3 | 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 | 5 | * Copyright OpenJS Foundation and other contributors <https://openjsf.org/> |
| 6 | 6 | * Released under MIT license <https://lodash.com/license> |
| 7 | 7 | * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> |
@@ -13,7 +13,7 @@ | ||
| 13 | 13 | var undefined; |
| 14 | 14 | |
| 15 | 15 | /** Used as the semantic version number. */ |
| 16 | var VERSION = '4.17.15'; | |
| 16 | var VERSION = '4.17.20'; | |
| 17 | 17 | |
| 18 | 18 | /** Error message constants. */ |
| 19 | 19 | var FUNC_ERROR_TEXT = 'Expected a function'; |
@@ -1183,6 +1183,12 @@ | ||
| 1183 | 1183 | if (arrLength != othLength && !(isPartial && othLength > arrLength)) { |
| 1184 | 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 | 1192 | var index = -1, |
| 1187 | 1193 | result = true, |
| 1188 | 1194 | seen = (bitmask & COMPARE_UNORDERED_FLAG) ? [] : undefined; |
@@ -1293,6 +1299,12 @@ | ||
| 1293 | 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 | 1308 | var result = true; |
| 1297 | 1309 | |
| 1298 | 1310 | var skipCtor = isPartial; |
@@ -1935,6 +1947,10 @@ | ||
| 1935 | 1947 | * // The `_.property` iteratee shorthand. |
| 1936 | 1948 | * _.filter(users, 'active'); |
| 1937 | 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 | 1955 | function filter(collection, predicate) { |
| 1940 | 1956 | return baseFilter(collection, baseIteratee(predicate)); |
@@ -2188,15 +2204,15 @@ | ||
| 2188 | 2204 | * var users = [ |
| 2189 | 2205 | * { 'user': 'fred', 'age': 48 }, |
| 2190 | 2206 | * { 'user': 'barney', 'age': 36 }, |
| 2191 | * { 'user': 'fred', 'age': 40 }, | |
| 2207 | * { 'user': 'fred', 'age': 30 }, | |
| 2192 | 2208 | * { 'user': 'barney', 'age': 34 } |
| 2193 | 2209 | * ]; |
| 2194 | 2210 | * |
| 2195 | 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 | 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 | 2217 | function sortBy(collection, iteratee) { |
| 2202 | 2218 | var index = 0; |
@@ -3503,6 +3519,9 @@ | ||
| 3503 | 3519 | * values against any array or object value, respectively. See `_.isEqual` |
| 3504 | 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 | 3525 | * @static |
| 3507 | 3526 | * @memberOf _ |
| 3508 | 3527 | * @since 3.0.0 |
@@ -3518,6 +3537,10 @@ | ||
| 3518 | 3537 | * |
| 3519 | 3538 | * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); |
| 3520 | 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 | 3545 | function matches(source) { |
| 3523 | 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 | 3868 | // Export for Node.js. |
| 3831 | 3869 | (freeModule.exports = lodash)._ = lodash; |
| 3832 | 3870 | // Export for CommonJS support. |
| 3833 | 3871 | freeExports._ = lodash; |
| 3834 | 3872 | } |
| 3873 | else { | |
| 3874 | // Export to the global object. | |
| 3875 | root._ = lodash; | |
| 3876 | } | |
| 3835 | 3877 | }.call(this)); |
@@ -39,6 +39,10 @@ | ||
| 39 | 39 | * // The `_.property` iteratee shorthand. |
| 40 | 40 | * _.filter(users, 'active'); |
| 41 | 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 | 47 | function filter(collection, predicate) { |
| 44 | 48 | var func = isArray(collection) ? arrayFilter : baseFilter; |
@@ -12,7 +12,7 @@ | ||
| 12 | 12 | var undefined; |
| 13 | 13 | |
| 14 | 14 | /** Used as the semantic version number. */ |
| 15 | var VERSION = '4.17.19'; | |
| 15 | var VERSION = '4.17.20'; | |
| 16 | 16 | |
| 17 | 17 | /** Used as the size to enable large array optimizations. */ |
| 18 | 18 | var LARGE_ARRAY_SIZE = 200; |
@@ -15588,7 +15588,7 @@ | ||
| 15588 | 15588 | * // => [{ 'a': 4, 'b': 5, 'c': 6 }] |
| 15589 | 15589 | * |
| 15590 | 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 | 15592 | * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] |
| 15593 | 15593 | */ |
| 15594 | 15594 | function matches(source) { |
@@ -15625,7 +15625,7 @@ | ||
| 15625 | 15625 | * // => { 'a': 4, 'b': 5, 'c': 6 } |
| 15626 | 15626 | * |
| 15627 | 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 | 15629 | * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] |
| 15630 | 15630 | */ |
| 15631 | 15631 | function matchesProperty(path, srcValue) { |
@@ -16,6 +16,9 @@ | ||
| 16 | 16 | * values against any array or object value, respectively. See `_.isEqual` |
| 17 | 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 | 22 | * @static |
| 20 | 23 | * @memberOf _ |
| 21 | 24 | * @since 3.0.0 |
@@ -31,6 +34,10 @@ | ||
| 31 | 34 | * |
| 32 | 35 | * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); |
| 33 | 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 | 42 | function matches(source) { |
| 36 | 43 | return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); |
@@ -13,6 +13,9 @@ | ||
| 13 | 13 | * `srcValue` values against any array or object value, respectively. See |
| 14 | 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 | 19 | * @static |
| 17 | 20 | * @memberOf _ |
| 18 | 21 | * @since 3.2.0 |
@@ -29,6 +32,10 @@ | ||
| 29 | 32 | * |
| 30 | 33 | * _.find(objects, _.matchesProperty('a', 4)); |
| 31 | 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 | 40 | function matchesProperty(path, srcValue) { |
| 34 | 41 | return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); |
@@ -5,6 +5,10 @@ | ||
| 5 | 5 | * Creates a function that checks if **all** of the `predicates` return |
| 6 | 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 | 12 | * @static |
| 9 | 13 | * @memberOf _ |
| 10 | 14 | * @since 4.0.0 |
@@ -5,6 +5,10 @@ | ||
| 5 | 5 | * Creates a function that checks if **any** of the `predicates` return |
| 6 | 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 | 12 | * @static |
| 9 | 13 | * @memberOf _ |
| 10 | 14 | * @since 4.0.0 |
@@ -24,6 +28,9 @@ | ||
| 24 | 28 | * |
| 25 | 29 | * func(NaN); |
| 26 | 30 | * // => false |
| 31 | * | |
| 32 | * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }]) | |
| 33 | * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]]) | |
| 27 | 34 | */ |
| 28 | 35 | var overSome = createOver(arraySome); |
| 29 | 36 | |
@@ -22,15 +22,15 @@ | ||
| 22 | 22 | * var users = [ |
| 23 | 23 | * { 'user': 'fred', 'age': 48 }, |
| 24 | 24 | * { 'user': 'barney', 'age': 36 }, |
| 25 | * { 'user': 'fred', 'age': 40 }, | |
| 25 | * { 'user': 'fred', 'age': 30 }, | |
| 26 | 26 | * { 'user': 'barney', 'age': 34 } |
| 27 | 27 | * ]; |
| 28 | 28 | * |
| 29 | 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 | 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 | 35 | var sortBy = baseRest(function(collection, iteratees) { |
| 36 | 36 | if (collection == null) { |
@@ -169,11 +169,11 @@ | ||
| 169 | 169 | |
| 170 | 170 | // Use a sourceURL for easier debugging. |
| 171 | 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 | 174 | var sourceURL = hasOwnProperty.call(options, 'sourceURL') |
| 175 | 175 | ? ('//# sourceURL=' + |
| 176 | (options.sourceURL + '').replace(/[\r\n]/g, ' ') + | |
| 176 | (options.sourceURL + '').replace(/\s/g, ' ') + | |
| 177 | 177 | '\n') |
| 178 | 178 | : ''; |
| 179 | 179 | |
@@ -206,8 +206,6 @@ | ||
| 206 | 206 | |
| 207 | 207 | // If `variable` is not specified wrap a with-statement around the generated |
| 208 | 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 | 209 | var variable = hasOwnProperty.call(options, 'variable') && options.variable; |
| 212 | 210 | if (!variable) { |
| 213 | 211 | source = 'with (obj) {\n' + source + '\n}\n'; |
@@ -1,4 +1,4 @@ | ||
| 1 | # lodash v4.17.19 | |
| 1 | # lodash v4.17.20 | |
| 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.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 | 33 | **Note:**<br> |
| 34 | 34 | Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL. |