mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d4f76888f |
@@ -1,4 +1,4 @@
|
|||||||
# lodash-es v4.14.0
|
# lodash-es v4.14.1
|
||||||
|
|
||||||
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.14.0-es) for more details.
|
See the [package source](https://github.com/lodash/lodash/tree/4.14.1-es) for more details.
|
||||||
|
|||||||
@@ -133,9 +133,6 @@ function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
|
|||||||
// Recursively populate clone (susceptible to call stack limits).
|
// Recursively populate clone (susceptible to call stack limits).
|
||||||
assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
|
assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
|
||||||
});
|
});
|
||||||
if (!isFull) {
|
|
||||||
stack['delete'](value);
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import baseRange from './_baseRange.js';
|
import baseRange from './_baseRange.js';
|
||||||
import isIterateeCall from './_isIterateeCall.js';
|
import isIterateeCall from './_isIterateeCall.js';
|
||||||
import toNumber from './toNumber.js';
|
import toFinite from './toFinite.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a `_.range` or `_.rangeRight` function.
|
* Creates a `_.range` or `_.rangeRight` function.
|
||||||
@@ -15,15 +15,14 @@ function createRange(fromRight) {
|
|||||||
end = step = undefined;
|
end = step = undefined;
|
||||||
}
|
}
|
||||||
// Ensure the sign of `-0` is preserved.
|
// Ensure the sign of `-0` is preserved.
|
||||||
start = toNumber(start);
|
start = toFinite(start);
|
||||||
start = start === start ? start : 0;
|
|
||||||
if (end === undefined) {
|
if (end === undefined) {
|
||||||
end = start;
|
end = start;
|
||||||
start = 0;
|
start = 0;
|
||||||
} else {
|
} else {
|
||||||
end = toNumber(end) || 0;
|
end = toFinite(end);
|
||||||
}
|
}
|
||||||
step = step === undefined ? (start < end ? 1 : -1) : (toNumber(step) || 0);
|
step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
|
||||||
return baseRange(start, end, step, fromRight);
|
return baseRange(start, end, step, fromRight);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stack['delete'](array);
|
stack['delete'](array);
|
||||||
|
stack['delete'](other);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stack['delete'](object);
|
stack['delete'](object);
|
||||||
|
stack['delete'](other);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import arrayPush from './_arrayPush.js';
|
import arrayPush from './_arrayPush.js';
|
||||||
import getPrototype from './_getPrototype.js';
|
import getPrototype from './_getPrototype.js';
|
||||||
import getSymbols from './_getSymbols.js';
|
import getSymbols from './_getSymbols.js';
|
||||||
|
import stubArray from './stubArray.js';
|
||||||
|
|
||||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||||
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
||||||
@@ -13,7 +14,7 @@ var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|||||||
* @param {Object} object The object to query.
|
* @param {Object} object The object to query.
|
||||||
* @returns {Array} Returns the array of symbols.
|
* @returns {Array} Returns the array of symbols.
|
||||||
*/
|
*/
|
||||||
var getSymbolsIn = !nativeGetSymbols ? getSymbols : function(object) {
|
var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
|
||||||
var result = [];
|
var result = [];
|
||||||
while (object) {
|
while (object) {
|
||||||
arrayPush(result, getSymbols(object));
|
arrayPush(result, getSymbols(object));
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
|
|||||||
*/
|
*/
|
||||||
function isFlattenable(value) {
|
function isFlattenable(value) {
|
||||||
return isArray(value) || isArguments(value) ||
|
return isArray(value) || isArguments(value) ||
|
||||||
!!(spreadableSymbol && value && value[spreadableSymbol])
|
!!(spreadableSymbol && value && value[spreadableSymbol]);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isFlattenable;
|
export default isFlattenable;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import freeGlobal from './_freeGlobal.js';
|
import freeGlobal from './_freeGlobal.js';
|
||||||
|
|
||||||
/** Detect free variable `exports`. */
|
/** Detect free variable `exports`. */
|
||||||
var freeExports = freeGlobal && typeof exports == 'object' && exports;
|
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
||||||
|
|
||||||
/** Detect free variable `module`. */
|
/** Detect free variable `module`. */
|
||||||
var freeModule = freeExports && typeof module == 'object' && module;
|
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
||||||
|
|
||||||
/** Detect the popular CommonJS extension `module.exports`. */
|
/** Detect the popular CommonJS extension `module.exports`. */
|
||||||
var moduleExports = freeModule && freeModule.exports === freeExports;
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import memoize from './memoize.js';
|
|||||||
import toString from './toString.js';
|
import toString from './toString.js';
|
||||||
|
|
||||||
/** Used to match property names within property paths. */
|
/** Used to match property names within property paths. */
|
||||||
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g;
|
var reLeadingDot = /^\./,
|
||||||
|
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
||||||
|
|
||||||
/** Used to match backslashes in property paths. */
|
/** Used to match backslashes in property paths. */
|
||||||
var reEscapeChar = /\\(\\)?/g;
|
var reEscapeChar = /\\(\\)?/g;
|
||||||
@@ -15,8 +16,13 @@ var reEscapeChar = /\\(\\)?/g;
|
|||||||
* @returns {Array} Returns the property path array.
|
* @returns {Array} Returns the property path array.
|
||||||
*/
|
*/
|
||||||
var stringToPath = memoize(function(string) {
|
var stringToPath = memoize(function(string) {
|
||||||
|
string = toString(string);
|
||||||
|
|
||||||
var result = [];
|
var result = [];
|
||||||
toString(string).replace(rePropName, function(match, number, quote, string) {
|
if (reLeadingDot.test(string)) {
|
||||||
|
result.push('');
|
||||||
|
}
|
||||||
|
string.replace(rePropName, function(match, number, quote, string) {
|
||||||
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
|
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import baseConforms from './_baseConforms.js';
|
|||||||
* the corresponding property values of a given object, returning `true` if
|
* the corresponding property values of a given object, returning `true` if
|
||||||
* all predicates return truthy, else `false`.
|
* all predicates return truthy, else `false`.
|
||||||
*
|
*
|
||||||
|
* **Note:** The created function is equivalent to `_.conformsTo` with
|
||||||
|
* `source` partially applied.
|
||||||
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 4.0.0
|
* @since 4.0.0
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ import baseConformsTo from './_baseConformsTo.js';
|
|||||||
import keys from './keys.js';
|
import keys from './keys.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `object` conforms to `source` by invoking the predicate properties
|
* Checks if `object` conforms to `source` by invoking the predicate
|
||||||
* of `source` with the corresponding property values of `object`. This method
|
* properties of `source` with the corresponding property values of `object`.
|
||||||
* is equivalent to a `_.conforms` function when `source` is partially applied.
|
*
|
||||||
|
* **Note:** This method is equivalent to `_.conforms` when `source` is
|
||||||
|
* partially applied.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
|
|||||||
18
debounce.js
18
debounce.js
@@ -14,14 +14,18 @@ var nativeMax = Math.max,
|
|||||||
* milliseconds have elapsed since the last time the debounced function was
|
* milliseconds have elapsed since the last time the debounced function was
|
||||||
* invoked. The debounced function comes with a `cancel` method to cancel
|
* invoked. The debounced function comes with a `cancel` method to cancel
|
||||||
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
||||||
* Provide an options object to indicate whether `func` should be invoked on
|
* Provide `options` to indicate whether `func` should be invoked on the
|
||||||
* the leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
||||||
* with the last arguments provided to the debounced function. Subsequent calls
|
* with the last arguments provided to the debounced function. Subsequent
|
||||||
* to the debounced function return the result of the last `func` invocation.
|
* calls to the debounced function return the result of the last `func`
|
||||||
|
* invocation.
|
||||||
*
|
*
|
||||||
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
|
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
||||||
* on the trailing edge of the timeout only if the debounced function is
|
* invoked on the trailing edge of the timeout only if the debounced function
|
||||||
* invoked more than once during the `wait` timeout.
|
* is invoked more than once during the `wait` timeout.
|
||||||
|
*
|
||||||
|
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
||||||
|
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
||||||
*
|
*
|
||||||
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
||||||
* for details over the differences between `_.debounce` and `_.throttle`.
|
* for details over the differences between `_.debounce` and `_.throttle`.
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import baseInRange from './_baseInRange.js';
|
import baseInRange from './_baseInRange.js';
|
||||||
|
import toFinite from './toFinite.js';
|
||||||
import toNumber from './toNumber.js';
|
import toNumber from './toNumber.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,12 +41,12 @@ import toNumber from './toNumber.js';
|
|||||||
* // => true
|
* // => true
|
||||||
*/
|
*/
|
||||||
function inRange(number, start, end) {
|
function inRange(number, start, end) {
|
||||||
start = toNumber(start) || 0;
|
start = toFinite(start);
|
||||||
if (end === undefined) {
|
if (end === undefined) {
|
||||||
end = start;
|
end = start;
|
||||||
start = 0;
|
start = 0;
|
||||||
} else {
|
} else {
|
||||||
end = toNumber(end) || 0;
|
end = toFinite(end);
|
||||||
}
|
}
|
||||||
number = toNumber(number);
|
number = toNumber(number);
|
||||||
return baseInRange(number, start, end);
|
return baseInRange(number, start, end);
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import freeGlobal from './_freeGlobal.js';
|
|
||||||
import root from './_root.js';
|
import root from './_root.js';
|
||||||
import stubFalse from './stubFalse.js';
|
import stubFalse from './stubFalse.js';
|
||||||
|
|
||||||
/** Detect free variable `exports`. */
|
/** Detect free variable `exports`. */
|
||||||
var freeExports = freeGlobal && typeof exports == 'object' && exports;
|
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
||||||
|
|
||||||
/** Detect free variable `module`. */
|
/** Detect free variable `module`. */
|
||||||
var freeModule = freeExports && typeof module == 'object' && module;
|
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
||||||
|
|
||||||
/** Detect the popular CommonJS extension `module.exports`. */
|
/** Detect the popular CommonJS extension `module.exports`. */
|
||||||
var moduleExports = freeModule && freeModule.exports === freeExports;
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import getMatchData from './_getMatchData.js';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a partial deep comparison between `object` and `source` to
|
* Performs a partial deep comparison between `object` and `source` to
|
||||||
* determine if `object` contains equivalent property values. This method is
|
* determine if `object` contains equivalent property values.
|
||||||
* equivalent to a `_.matches` function when `source` is partially applied.
|
|
||||||
*
|
*
|
||||||
* **Note:** This method supports comparing the same values as `_.isEqual`.
|
* **Note:** This method supports comparing the same values as `_.isEqual`
|
||||||
|
* and is equivalent to `_.matches` when `source` is partially applied.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
|
|||||||
@@ -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.14.0';
|
var VERSION = '4.14.1';
|
||||||
|
|
||||||
/** Used to compose bitmasks for function metadata. */
|
/** Used to compose bitmasks for function metadata. */
|
||||||
var BIND_KEY_FLAG = 2;
|
var BIND_KEY_FLAG = 2;
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import baseMatches from './_baseMatches.js';
|
|||||||
/**
|
/**
|
||||||
* Creates a function that performs a partial deep comparison between a given
|
* Creates a function that performs a partial deep comparison between a given
|
||||||
* object and `source`, returning `true` if the given object has equivalent
|
* object and `source`, returning `true` if the given object has equivalent
|
||||||
* property values, else `false`. The created function is equivalent to
|
* property values, else `false`.
|
||||||
* `_.isMatch` with a `source` partially applied.
|
|
||||||
*
|
*
|
||||||
* **Note:** This method supports comparing the same values as `_.isEqual`.
|
* **Note:** The created function supports comparing the same values as
|
||||||
|
* `_.isEqual` is equivalent to `_.isMatch` with `source` partially applied.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lodash-es",
|
"name": "lodash-es",
|
||||||
"version": "4.14.0",
|
"version": "4.14.1",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import baseRandom from './_baseRandom.js';
|
import baseRandom from './_baseRandom.js';
|
||||||
import isIterateeCall from './_isIterateeCall.js';
|
import isIterateeCall from './_isIterateeCall.js';
|
||||||
import toNumber from './toNumber.js';
|
import toFinite from './toFinite.js';
|
||||||
|
|
||||||
/** Built-in method references without a dependency on `root`. */
|
/** Built-in method references without a dependency on `root`. */
|
||||||
var freeParseFloat = parseFloat;
|
var freeParseFloat = parseFloat;
|
||||||
@@ -59,12 +59,12 @@ function random(lower, upper, floating) {
|
|||||||
upper = 1;
|
upper = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lower = toNumber(lower) || 0;
|
lower = toFinite(lower);
|
||||||
if (upper === undefined) {
|
if (upper === undefined) {
|
||||||
upper = lower;
|
upper = lower;
|
||||||
lower = 0;
|
lower = 0;
|
||||||
} else {
|
} else {
|
||||||
upper = toNumber(upper) || 0;
|
upper = toFinite(upper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lower > upper) {
|
if (lower > upper) {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ var FUNC_ERROR_TEXT = 'Expected a function';
|
|||||||
* Creates a throttled function that only invokes `func` at most once per
|
* Creates a throttled function that only invokes `func` at most once per
|
||||||
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
||||||
* method to cancel delayed `func` invocations and a `flush` method to
|
* method to cancel delayed `func` invocations and a `flush` method to
|
||||||
* immediately invoke them. Provide an options object to indicate whether
|
* immediately invoke them. Provide `options` to indicate whether `func`
|
||||||
* `func` should be invoked on the leading and/or trailing edge of the `wait`
|
* should be invoked on the leading and/or trailing edge of the `wait`
|
||||||
* timeout. The `func` is invoked with the last arguments provided to the
|
* timeout. The `func` is invoked with the last arguments provided to the
|
||||||
* throttled function. Subsequent calls to the throttled function return the
|
* throttled function. Subsequent calls to the throttled function return the
|
||||||
* result of the last `func` invocation.
|
* result of the last `func` invocation.
|
||||||
@@ -18,6 +18,9 @@ var FUNC_ERROR_TEXT = 'Expected a function';
|
|||||||
* invoked on the trailing edge of the timeout only if the throttled function
|
* invoked on the trailing edge of the timeout only if the throttled function
|
||||||
* is invoked more than once during the `wait` timeout.
|
* is invoked more than once during the `wait` timeout.
|
||||||
*
|
*
|
||||||
|
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
||||||
|
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
||||||
|
*
|
||||||
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
||||||
* for details over the differences between `_.throttle` and `_.debounce`.
|
* for details over the differences between `_.throttle` and `_.debounce`.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user