mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Compare commits
1 Commits
4.17.15-es
...
4.17.20-es
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42e2585e5f |
@@ -1,4 +1,4 @@
|
|||||||
# lodash-es v4.17.15
|
# lodash-es v4.17.20
|
||||||
|
|
||||||
The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules.
|
The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules.
|
||||||
|
|
||||||
@@ -7,4 +7,4 @@ Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
|
|||||||
$ lodash modularize exports=es -o ./
|
$ lodash modularize exports=es -o ./
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [package source](https://github.com/lodash/lodash/tree/4.17.15-es) for more details.
|
See the [package source](https://github.com/lodash/lodash/tree/4.17.20-es) for more details.
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import isMap from './isMap.js';
|
|||||||
import isObject from './isObject.js';
|
import isObject from './isObject.js';
|
||||||
import isSet from './isSet.js';
|
import isSet from './isSet.js';
|
||||||
import keys from './keys.js';
|
import keys from './keys.js';
|
||||||
|
import keysIn from './keysIn.js';
|
||||||
|
|
||||||
/** Used to compose bitmasks for cloning. */
|
/** Used to compose bitmasks for cloning. */
|
||||||
var CLONE_DEEP_FLAG = 1,
|
var CLONE_DEEP_FLAG = 1,
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import arrayMap from './_arrayMap.js';
|
import arrayMap from './_arrayMap.js';
|
||||||
|
import baseGet from './_baseGet.js';
|
||||||
import baseIteratee from './_baseIteratee.js';
|
import baseIteratee from './_baseIteratee.js';
|
||||||
import baseMap from './_baseMap.js';
|
import baseMap from './_baseMap.js';
|
||||||
import baseSortBy from './_baseSortBy.js';
|
import baseSortBy from './_baseSortBy.js';
|
||||||
import baseUnary from './_baseUnary.js';
|
import baseUnary from './_baseUnary.js';
|
||||||
import compareMultiple from './_compareMultiple.js';
|
import compareMultiple from './_compareMultiple.js';
|
||||||
import identity from './identity.js';
|
import identity from './identity.js';
|
||||||
|
import isArray from './isArray.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.orderBy` without param guards.
|
* The base implementation of `_.orderBy` without param guards.
|
||||||
@@ -16,8 +18,21 @@ import identity from './identity.js';
|
|||||||
* @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(baseIteratee));
|
iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
|
||||||
|
|
||||||
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) {
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ function baseSet(object, path, value, customizer) {
|
|||||||
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;
|
||||||
|
|||||||
@@ -22,11 +22,14 @@ var nativeFloor = Math.floor,
|
|||||||
* into `array`.
|
* into `array`.
|
||||||
*/
|
*/
|
||||||
function baseSortedIndexBy(array, value, iteratee, retHighest) {
|
function baseSortedIndexBy(array, value, iteratee, retHighest) {
|
||||||
value = iteratee(value);
|
|
||||||
|
|
||||||
var low = 0,
|
var low = 0,
|
||||||
high = array == null ? 0 : array.length,
|
high = array == null ? 0 : array.length;
|
||||||
valIsNaN = value !== value,
|
if (high === 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = iteratee(value);
|
||||||
|
var valIsNaN = value !== value,
|
||||||
valIsNull = value === null,
|
valIsNull = value === null,
|
||||||
valIsSymbol = isSymbol(value),
|
valIsSymbol = isSymbol(value),
|
||||||
valIsUndefined = value === undefined;
|
valIsUndefined = value === undefined;
|
||||||
|
|||||||
@@ -27,10 +27,11 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|||||||
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,
|
||||||
|
|||||||
@@ -39,10 +39,11 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|||||||
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);
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ import isArray from './isArray.js';
|
|||||||
* // 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;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ import toInteger from './toInteger.js';
|
|||||||
import lodash from './wrapperLodash.js';
|
import lodash from './wrapperLodash.js';
|
||||||
|
|
||||||
/** Used as the semantic version number. */
|
/** Used as the semantic version number. */
|
||||||
var VERSION = '4.17.15';
|
var VERSION = '4.17.20';
|
||||||
|
|
||||||
/** Used to compose bitmasks for function metadata. */
|
/** Used to compose bitmasks for function metadata. */
|
||||||
var WRAP_BIND_KEY_FLAG = 2;
|
var WRAP_BIND_KEY_FLAG = 2;
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ var CLONE_DEEP_FLAG = 1;
|
|||||||
* values against any array or object value, respectively. See `_.isEqual`
|
* values against any array or object value, respectively. See `_.isEqual`
|
||||||
* for a list of supported value comparisons.
|
* for a list of supported value comparisons.
|
||||||
*
|
*
|
||||||
|
* **Note:** Multiple values can be checked by combining several matchers
|
||||||
|
* using `_.overSome`
|
||||||
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
@@ -31,6 +34,10 @@ var CLONE_DEEP_FLAG = 1;
|
|||||||
*
|
*
|
||||||
* _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
|
* _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
|
||||||
* // => [{ 'a': 4, 'b': 5, 'c': 6 }]
|
* // => [{ 'a': 4, 'b': 5, 'c': 6 }]
|
||||||
|
*
|
||||||
|
* // Checking for several possible values
|
||||||
|
* _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
|
||||||
|
* // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
|
||||||
*/
|
*/
|
||||||
function matches(source) {
|
function matches(source) {
|
||||||
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
|
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ var CLONE_DEEP_FLAG = 1;
|
|||||||
* `srcValue` values against any array or object value, respectively. See
|
* `srcValue` values against any array or object value, respectively. See
|
||||||
* `_.isEqual` for a list of supported value comparisons.
|
* `_.isEqual` for a list of supported value comparisons.
|
||||||
*
|
*
|
||||||
|
* **Note:** Multiple values can be checked by combining several matchers
|
||||||
|
* using `_.overSome`
|
||||||
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
@@ -29,6 +32,10 @@ var CLONE_DEEP_FLAG = 1;
|
|||||||
*
|
*
|
||||||
* _.find(objects, _.matchesProperty('a', 4));
|
* _.find(objects, _.matchesProperty('a', 4));
|
||||||
* // => { 'a': 4, 'b': 5, 'c': 6 }
|
* // => { 'a': 4, 'b': 5, 'c': 6 }
|
||||||
|
*
|
||||||
|
* // Checking for several possible values
|
||||||
|
* _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
|
||||||
|
* // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
|
||||||
*/
|
*/
|
||||||
function matchesProperty(path, srcValue) {
|
function matchesProperty(path, srcValue) {
|
||||||
return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
|
return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ import createOver from './_createOver.js';
|
|||||||
* Creates a function that checks if **all** of the `predicates` return
|
* Creates a function that checks if **all** of the `predicates` return
|
||||||
* truthy when invoked with the arguments it receives.
|
* truthy when invoked with the arguments it receives.
|
||||||
*
|
*
|
||||||
|
* Following shorthands are possible for providing predicates.
|
||||||
|
* Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
|
||||||
|
* Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
|
||||||
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 4.0.0
|
* @since 4.0.0
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ import createOver from './_createOver.js';
|
|||||||
* Creates a function that checks if **any** of the `predicates` return
|
* Creates a function that checks if **any** of the `predicates` return
|
||||||
* truthy when invoked with the arguments it receives.
|
* truthy when invoked with the arguments it receives.
|
||||||
*
|
*
|
||||||
|
* Following shorthands are possible for providing predicates.
|
||||||
|
* Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
|
||||||
|
* Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
|
||||||
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 4.0.0
|
* @since 4.0.0
|
||||||
@@ -24,6 +28,9 @@ import createOver from './_createOver.js';
|
|||||||
*
|
*
|
||||||
* func(NaN);
|
* func(NaN);
|
||||||
* // => false
|
* // => false
|
||||||
|
*
|
||||||
|
* var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
|
||||||
|
* var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
|
||||||
*/
|
*/
|
||||||
var overSome = createOver(arraySome);
|
var overSome = createOver(arraySome);
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "lodash-es",
|
"name": "lodash-es",
|
||||||
"version": "4.17.15",
|
"version": "4.17.20",
|
||||||
"description": "Lodash exported as ES modules.",
|
"description": "Lodash exported as ES modules.",
|
||||||
"keywords": "es6, modules, stdlib, util",
|
"keywords": "es6, modules, stdlib, util",
|
||||||
"homepage": "https://lodash.com/custom-builds",
|
"homepage": "https://lodash.com/custom-builds",
|
||||||
"bugs": "https://github.com/lodash/lodash-cli/issues",
|
"bugs": "https://github.com/lodash/lodash-cli/issues",
|
||||||
"repository": "lodash/lodash",
|
"repository": "lodash/lodash",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"type": "module",
|
||||||
"jsnext:main": "lodash.js",
|
"jsnext:main": "lodash.js",
|
||||||
"main": "lodash.js",
|
"main": "lodash.js",
|
||||||
"module": "lodash.js",
|
"module": "lodash.js",
|
||||||
|
|||||||
@@ -22,15 +22,15 @@ import isIterateeCall from './_isIterateeCall.js';
|
|||||||
* 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) {
|
||||||
|
|||||||
@@ -169,11 +169,11 @@ function template(string, options, guard) {
|
|||||||
|
|
||||||
// Use a sourceURL for easier debugging.
|
// Use a sourceURL for easier debugging.
|
||||||
// The sourceURL gets injected into the source that's eval-ed, so be careful
|
// The sourceURL gets injected into the source that's eval-ed, so be careful
|
||||||
// with lookup (in case of e.g. prototype pollution), and strip newlines if any.
|
// to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
|
||||||
// A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
|
// and escape the comment, thus injecting code that gets evaled.
|
||||||
var sourceURL = hasOwnProperty.call(options, 'sourceURL')
|
var sourceURL = hasOwnProperty.call(options, 'sourceURL')
|
||||||
? ('//# sourceURL=' +
|
? ('//# sourceURL=' +
|
||||||
(options.sourceURL + '').replace(/[\r\n]/g, ' ') +
|
(options.sourceURL + '').replace(/\s/g, ' ') +
|
||||||
'\n')
|
'\n')
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
@@ -206,8 +206,6 @@ function template(string, options, guard) {
|
|||||||
|
|
||||||
// If `variable` is not specified wrap a with-statement around the generated
|
// If `variable` is not specified wrap a with-statement around the generated
|
||||||
// code to add the data object to the top of the scope chain.
|
// code to add the data object to the top of the scope chain.
|
||||||
// Like with sourceURL, we take care to not check the option's prototype,
|
|
||||||
// as this configuration is a code injection vector.
|
|
||||||
var variable = hasOwnProperty.call(options, 'variable') && options.variable;
|
var variable = hasOwnProperty.call(options, 'variable') && options.variable;
|
||||||
if (!variable) {
|
if (!variable) {
|
||||||
source = 'with (obj) {\n' + source + '\n}\n';
|
source = 'with (obj) {\n' + source + '\n}\n';
|
||||||
|
|||||||
Reference in New Issue
Block a user