mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
Compare commits
2 Commits
4.14.0-amd
...
4.14.2-amd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d3ce0979f | ||
|
|
623a72a129 |
@@ -1,4 +1,4 @@
|
||||
# lodash-amd v4.14.0
|
||||
# lodash-amd v4.14.2
|
||||
|
||||
The [Lodash](https://lodash.com/) library exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules.
|
||||
|
||||
@@ -27,4 +27,4 @@ require({
|
||||
});
|
||||
```
|
||||
|
||||
See the [package source](https://github.com/lodash/lodash/tree/4.14.0-amd) for more details.
|
||||
See the [package source](https://github.com/lodash/lodash/tree/4.14.2-amd) for more details.
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
define(['./_root'], function(root) {
|
||||
|
||||
/** Built-in value references. */
|
||||
var Reflect = root.Reflect;
|
||||
|
||||
return Reflect;
|
||||
});
|
||||
35
_arrayLikeKeys.js
Normal file
35
_arrayLikeKeys.js
Normal file
@@ -0,0 +1,35 @@
|
||||
define(['./_baseTimes', './isArguments', './isArray', './_isIndex', './isString'], function(baseTimes, isArguments, isArray, isIndex, isString) {
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Creates an array of the enumerable property names of the array-like `value`.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to query.
|
||||
* @param {boolean} inherited Specify returning inherited property names.
|
||||
* @returns {Array} Returns the array of property names.
|
||||
*/
|
||||
function arrayLikeKeys(value, inherited) {
|
||||
var result = (isArray(value) || isString(value) || isArguments(value))
|
||||
? baseTimes(value.length, String)
|
||||
: [];
|
||||
|
||||
var length = result.length,
|
||||
skipIndexes = !!length;
|
||||
|
||||
for (var key in value) {
|
||||
if ((inherited || hasOwnProperty.call(value, key)) &&
|
||||
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
|
||||
result.push(key);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return arrayLikeKeys;
|
||||
});
|
||||
@@ -11,7 +11,7 @@ define(['./eq'], function(eq) {
|
||||
|
||||
/**
|
||||
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* @private
|
||||
|
||||
@@ -120,9 +120,6 @@ define(['./_Stack', './_arrayEach', './_assignValue', './_baseAssign', './_clone
|
||||
// Recursively populate clone (susceptible to call stack limits).
|
||||
assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
|
||||
});
|
||||
if (!isFull) {
|
||||
stack['delete'](value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,14 +16,13 @@ define([], function() {
|
||||
if (object == null) {
|
||||
return !length;
|
||||
}
|
||||
var index = length;
|
||||
while (index--) {
|
||||
var key = props[index],
|
||||
object = Object(object);
|
||||
while (length--) {
|
||||
var key = props[length],
|
||||
predicate = source[key],
|
||||
value = object[key];
|
||||
|
||||
if ((value === undefined &&
|
||||
!(key in Object(object))) || !predicate(value)) {
|
||||
if ((value === undefined && !(key in object)) || !predicate(value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ define([], function() {
|
||||
* @param {Function} func The function to delay.
|
||||
* @param {number} wait The number of milliseconds to delay invocation.
|
||||
* @param {Array} args The arguments to provide to `func`.
|
||||
* @returns {number} Returns the timer id.
|
||||
* @returns {number|Object} Returns the timer id or timeout object.
|
||||
*/
|
||||
function baseDelay(func, wait, args) {
|
||||
if (typeof func != 'function') {
|
||||
|
||||
@@ -5,7 +5,7 @@ define([], function() {
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_getPrototype'], function(getPrototype) {
|
||||
define([], function() {
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
@@ -15,12 +15,7 @@ define(['./_getPrototype'], function(getPrototype) {
|
||||
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
||||
*/
|
||||
function baseHas(object, key) {
|
||||
// Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,
|
||||
// that are composed entirely of index properties, return `false` for
|
||||
// `hasOwnProperty` checks of them.
|
||||
return object != null &&
|
||||
(hasOwnProperty.call(object, key) ||
|
||||
(typeof object == 'object' && key in object && getPrototype(object) === null));
|
||||
return object != null && hasOwnProperty.call(object, key);
|
||||
}
|
||||
|
||||
return baseHas;
|
||||
|
||||
@@ -7,7 +7,7 @@ define(['./isObjectLike'], function(isObjectLike) {
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -8,7 +8,7 @@ define(['./isObjectLike'], function(isObjectLike) {
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -2,7 +2,7 @@ define(['./isFunction', './_isHostObject', './_isMasked', './isObject', './_toSo
|
||||
|
||||
/**
|
||||
* Used to match `RegExp`
|
||||
* [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns).
|
||||
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
||||
*/
|
||||
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ define(['./isObject'], function(isObject) {
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -48,7 +48,7 @@ define(['./isLength', './isObjectLike'], function(isLength, isObjectLike) {
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
25
_baseKeys.js
25
_baseKeys.js
@@ -1,17 +1,30 @@
|
||||
define(['./_overArg'], function(overArg) {
|
||||
define(['./_isPrototype', './_nativeKeys'], function(isPrototype, nativeKeys) {
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeKeys = Object.keys;
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* The base implementation of `_.keys` which doesn't skip the constructor
|
||||
* property of prototypes or treat sparse arrays as dense.
|
||||
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array} Returns the array of property names.
|
||||
*/
|
||||
var baseKeys = overArg(nativeKeys, Object);
|
||||
function baseKeys(object) {
|
||||
if (!isPrototype(object)) {
|
||||
return nativeKeys(object);
|
||||
}
|
||||
var result = [];
|
||||
for (var key in Object(object)) {
|
||||
if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
||||
result.push(key);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return baseKeys;
|
||||
});
|
||||
|
||||
@@ -1,39 +1,32 @@
|
||||
define(['./_Reflect', './_iteratorToArray'], function(Reflect, iteratorToArray) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
define(['./isObject', './_isPrototype', './_nativeKeysIn'], function(isObject, isPrototype, nativeKeysIn) {
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Built-in value references. */
|
||||
var enumerate = Reflect ? Reflect.enumerate : undefined,
|
||||
propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* The base implementation of `_.keysIn` which doesn't skip the constructor
|
||||
* property of prototypes or treat sparse arrays as dense.
|
||||
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array} Returns the array of property names.
|
||||
*/
|
||||
function baseKeysIn(object) {
|
||||
object = object == null ? object : Object(object);
|
||||
if (!isObject(object)) {
|
||||
return nativeKeysIn(object);
|
||||
}
|
||||
var isProto = isPrototype(object),
|
||||
result = [];
|
||||
|
||||
var result = [];
|
||||
for (var key in object) {
|
||||
result.push(key);
|
||||
if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
|
||||
result.push(key);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Fallback for IE < 9 with es6-shim.
|
||||
if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) {
|
||||
baseKeysIn = function(object) {
|
||||
return iteratorToArray(enumerate(object));
|
||||
};
|
||||
}
|
||||
|
||||
return baseKeysIn;
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_Stack', './_arrayEach', './_assignMergeValue', './_baseMergeDeep', './isArray', './isObject', './isTypedArray', './keysIn'], function(Stack, arrayEach, assignMergeValue, baseMergeDeep, isArray, isObject, isTypedArray, keysIn) {
|
||||
define(['./_Stack', './_arrayEach', './_assignMergeValue', './_baseKeysIn', './_baseMergeDeep', './isArray', './isObject', './isTypedArray'], function(Stack, arrayEach, assignMergeValue, baseKeysIn, baseMergeDeep, isArray, isObject, isTypedArray) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -19,7 +19,7 @@ define(['./_Stack', './_arrayEach', './_assignMergeValue', './_baseMergeDeep', '
|
||||
return;
|
||||
}
|
||||
if (!(isArray(source) || isTypedArray(source))) {
|
||||
var props = keysIn(source);
|
||||
var props = baseKeysIn(source);
|
||||
}
|
||||
arrayEach(props || source, function(srcValue, key) {
|
||||
if (props) {
|
||||
|
||||
26
_baseSet.js
26
_baseSet.js
@@ -14,6 +14,9 @@ define(['./_assignValue', './_castPath', './_isIndex', './_isKey', './isObject',
|
||||
* @returns {Object} Returns `object`.
|
||||
*/
|
||||
function baseSet(object, path, value, customizer) {
|
||||
if (!isObject(object)) {
|
||||
return object;
|
||||
}
|
||||
path = isKey(path, object) ? [path] : castPath(path);
|
||||
|
||||
var index = -1,
|
||||
@@ -22,20 +25,19 @@ define(['./_assignValue', './_castPath', './_isIndex', './_isKey', './isObject',
|
||||
nested = object;
|
||||
|
||||
while (nested != null && ++index < length) {
|
||||
var key = toKey(path[index]);
|
||||
if (isObject(nested)) {
|
||||
var newValue = value;
|
||||
if (index != lastIndex) {
|
||||
var objValue = nested[key];
|
||||
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
||||
if (newValue === undefined) {
|
||||
newValue = objValue == null
|
||||
? (isIndex(path[index + 1]) ? [] : {})
|
||||
: objValue;
|
||||
}
|
||||
var key = toKey(path[index]),
|
||||
newValue = value;
|
||||
|
||||
if (index != lastIndex) {
|
||||
var objValue = nested[key];
|
||||
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
||||
if (newValue === undefined) {
|
||||
newValue = isObject(objValue)
|
||||
? objValue
|
||||
: (isIndex(path[index + 1]) ? [] : {});
|
||||
}
|
||||
assignValue(nested, key, newValue);
|
||||
}
|
||||
assignValue(nested, key, newValue);
|
||||
nested = nested[key];
|
||||
}
|
||||
return object;
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
define(['./_baseHas', './_castPath', './_isKey', './last', './_parent', './_toKey'], function(baseHas, castPath, isKey, last, parent, toKey) {
|
||||
define(['./_castPath', './_isKey', './last', './_parent', './_toKey'], function(castPath, isKey, last, parent, toKey) {
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* The base implementation of `_.unset`.
|
||||
@@ -13,7 +19,7 @@ define(['./_baseHas', './_castPath', './_isKey', './last', './_parent', './_toKe
|
||||
object = parent(object, path);
|
||||
|
||||
var key = toKey(last(path));
|
||||
return !(object != null && baseHas(object, key)) || delete object[key];
|
||||
return !(object != null && hasOwnProperty.call(object, key)) || delete object[key];
|
||||
}
|
||||
|
||||
return baseUnset;
|
||||
|
||||
@@ -11,7 +11,7 @@ define(['./_baseCreate', './isObject'], function(baseCreate, isObject) {
|
||||
function createCtor(Ctor) {
|
||||
return function() {
|
||||
// Use a `switch` statement to work with class constructors. See
|
||||
// http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
|
||||
// http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
|
||||
// for more details.
|
||||
var args = arguments;
|
||||
switch (args.length) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_baseRange', './_isIterateeCall', './toNumber'], function(baseRange, isIterateeCall, toNumber) {
|
||||
define(['./_baseRange', './_isIterateeCall', './toFinite'], function(baseRange, isIterateeCall, toFinite) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -16,15 +16,14 @@ define(['./_baseRange', './_isIterateeCall', './toNumber'], function(baseRange,
|
||||
end = step = undefined;
|
||||
}
|
||||
// Ensure the sign of `-0` is preserved.
|
||||
start = toNumber(start);
|
||||
start = start === start ? start : 0;
|
||||
start = toFinite(start);
|
||||
if (end === undefined) {
|
||||
end = start;
|
||||
start = 0;
|
||||
} 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);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ define(['./_SetCache', './_arraySome'], function(SetCache, arraySome) {
|
||||
}
|
||||
}
|
||||
stack['delete'](array);
|
||||
stack['delete'](other);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ define(['./_Symbol', './_Uint8Array', './eq', './_equalArrays', './_mapToArray',
|
||||
case regexpTag:
|
||||
case stringTag:
|
||||
// Coerce regexes to strings and treat strings, primitives and objects,
|
||||
// as equal. See http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype.tostring
|
||||
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
|
||||
// for more details.
|
||||
return object == (other + '');
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_baseHas', './keys'], function(baseHas, keys) {
|
||||
define(['./keys'], function(keys) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -6,6 +6,12 @@ define(['./_baseHas', './keys'], function(baseHas, keys) {
|
||||
/** Used to compose bitmasks for comparison styles. */
|
||||
var PARTIAL_COMPARE_FLAG = 2;
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* A specialized version of `baseIsEqualDeep` for objects with support for
|
||||
* partial deep comparisons.
|
||||
@@ -33,7 +39,7 @@ define(['./_baseHas', './keys'], function(baseHas, keys) {
|
||||
var index = objLength;
|
||||
while (index--) {
|
||||
var key = objProps[index];
|
||||
if (!(isPartial ? key in other : baseHas(other, key))) {
|
||||
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -80,6 +86,7 @@ define(['./_baseHas', './keys'], function(baseHas, keys) {
|
||||
}
|
||||
}
|
||||
stack['delete'](object);
|
||||
stack['delete'](other);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
define(['./_baseProperty'], function(baseProperty) {
|
||||
|
||||
/**
|
||||
* Gets the "length" property value of `object`.
|
||||
*
|
||||
* **Note:** This function is used to avoid a
|
||||
* [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects
|
||||
* Safari on at least iOS 8.1-8.3 ARM64.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {*} Returns the "length" value.
|
||||
*/
|
||||
var getLength = baseProperty('length');
|
||||
|
||||
return getLength;
|
||||
});
|
||||
@@ -1,16 +1,7 @@
|
||||
define(['./_overArg'], function(overArg) {
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeGetPrototype = Object.getPrototypeOf;
|
||||
|
||||
/**
|
||||
* Gets the `[[Prototype]]` of `value`.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to query.
|
||||
* @returns {null|Object} Returns the `[[Prototype]]`.
|
||||
*/
|
||||
var getPrototype = overArg(nativeGetPrototype, Object);
|
||||
/** Built-in value references. */
|
||||
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
||||
|
||||
return getPrototype;
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_arrayPush', './_getPrototype', './_getSymbols'], function(arrayPush, getPrototype, getSymbols) {
|
||||
define(['./_arrayPush', './_getPrototype', './_getSymbols', './stubArray'], function(arrayPush, getPrototype, getSymbols, stubArray) {
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
||||
@@ -11,7 +11,7 @@ define(['./_arrayPush', './_getPrototype', './_getSymbols'], function(arrayPush,
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array} Returns the array of symbols.
|
||||
*/
|
||||
var getSymbolsIn = !nativeGetSymbols ? getSymbols : function(object) {
|
||||
var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
|
||||
var result = [];
|
||||
while (object) {
|
||||
arrayPush(result, getSymbols(object));
|
||||
|
||||
@@ -17,7 +17,7 @@ define(['./_DataView', './_Map', './_Promise', './_Set', './_WeakMap', './_baseG
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
define(['./_baseTimes', './isArguments', './isArray', './isLength', './isString'], function(baseTimes, isArguments, isArray, isLength, isString) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/**
|
||||
* Creates an array of index keys for `object` values of arrays,
|
||||
* `arguments` objects, and strings, otherwise `null` is returned.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array|null} Returns index keys, else `null`.
|
||||
*/
|
||||
function indexKeys(object) {
|
||||
var length = object ? object.length : undefined;
|
||||
if (isLength(length) &&
|
||||
(isArray(object) || isString(object) || isArguments(object))) {
|
||||
return baseTimes(length, String);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return indexKeys;
|
||||
});
|
||||
@@ -15,7 +15,7 @@ define(['./_Symbol', './isArguments', './isArray'], function(Symbol, isArguments
|
||||
*/
|
||||
function isFlattenable(value) {
|
||||
return isArray(value) || isArguments(value) ||
|
||||
!!(spreadableSymbol && value && value[spreadableSymbol])
|
||||
!!(spreadableSymbol && value && value[spreadableSymbol]);
|
||||
}
|
||||
|
||||
return isFlattenable;
|
||||
|
||||
7
_nativeKeys.js
Normal file
7
_nativeKeys.js
Normal file
@@ -0,0 +1,7 @@
|
||||
define(['./_overArg'], function(overArg) {
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeKeys = overArg(Object.keys, Object);
|
||||
|
||||
return nativeKeys;
|
||||
});
|
||||
23
_nativeKeysIn.js
Normal file
23
_nativeKeysIn.js
Normal file
@@ -0,0 +1,23 @@
|
||||
define([], function() {
|
||||
|
||||
/**
|
||||
* This function is like
|
||||
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
||||
* except that it includes inherited enumerable properties.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array} Returns the array of property names.
|
||||
*/
|
||||
function nativeKeysIn(object) {
|
||||
var result = [];
|
||||
if (object != null) {
|
||||
for (var key in Object(object)) {
|
||||
result.push(key);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return nativeKeysIn;
|
||||
});
|
||||
@@ -1,10 +1,10 @@
|
||||
define(['./_freeGlobal'], function(freeGlobal) {
|
||||
|
||||
/** Detect free variable `exports`. */
|
||||
var freeExports = freeGlobal && typeof exports == 'object' && exports;
|
||||
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
||||
|
||||
/** 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`. */
|
||||
var moduleExports = freeModule && freeModule.exports === freeExports;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
define([], function() {
|
||||
|
||||
/**
|
||||
* Creates a function that invokes `func` with its first argument transformed.
|
||||
* Creates a unary function that invokes `func` with its argument transformed.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to wrap.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
define(['./memoize', './toString'], function(memoize, toString) {
|
||||
|
||||
/** 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. */
|
||||
var reEscapeChar = /\\(\\)?/g;
|
||||
@@ -14,8 +15,13 @@ define(['./memoize', './toString'], function(memoize, toString) {
|
||||
* @returns {Array} Returns the property path array.
|
||||
*/
|
||||
var stringToPath = memoize(function(string) {
|
||||
string = toString(string);
|
||||
|
||||
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));
|
||||
});
|
||||
return result;
|
||||
|
||||
19
assignIn.js
19
assignIn.js
@@ -1,13 +1,4 @@
|
||||
define(['./_assignValue', './_copyObject', './_createAssigner', './isArrayLike', './_isPrototype', './keysIn'], function(assignValue, copyObject, createAssigner, isArrayLike, isPrototype, keysIn) {
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Built-in value references. */
|
||||
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
||||
|
||||
/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */
|
||||
var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');
|
||||
define(['./_copyObject', './_createAssigner', './keysIn'], function(copyObject, createAssigner, keysIn) {
|
||||
|
||||
/**
|
||||
* This method is like `_.assign` except that it iterates over own and
|
||||
@@ -41,13 +32,7 @@ define(['./_assignValue', './_copyObject', './_createAssigner', './isArrayLike',
|
||||
* // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
|
||||
*/
|
||||
var assignIn = createAssigner(function(object, source) {
|
||||
if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {
|
||||
copyObject(source, keysIn(source), object);
|
||||
return;
|
||||
}
|
||||
for (var key in source) {
|
||||
assignValue(object, key, source[key]);
|
||||
}
|
||||
copyObject(source, keysIn(source), object);
|
||||
});
|
||||
|
||||
return assignIn;
|
||||
|
||||
@@ -5,6 +5,9 @@ define(['./_baseClone', './_baseConforms'], function(baseClone, baseConforms) {
|
||||
* the corresponding property values of a given object, returning `true` if
|
||||
* all predicates return truthy, else `false`.
|
||||
*
|
||||
* **Note:** The created function is equivalent to `_.conformsTo` with
|
||||
* `source` partially applied.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
define(['./_baseConformsTo', './keys'], function(baseConformsTo, keys) {
|
||||
|
||||
/**
|
||||
* Checks if `object` conforms to `source` by invoking the predicate properties
|
||||
* of `source` with the corresponding property values of `object`. This method
|
||||
* is equivalent to a `_.conforms` function when `source` is partially applied.
|
||||
* Checks if `object` conforms to `source` by invoking the predicate
|
||||
* properties of `source` with the corresponding property values of `object`.
|
||||
*
|
||||
* **Note:** This method is equivalent to `_.conforms` when `source` is
|
||||
* partially applied.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
18
debounce.js
18
debounce.js
@@ -15,14 +15,18 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
|
||||
* milliseconds have elapsed since the last time the debounced function was
|
||||
* invoked. The debounced function comes with a `cancel` method to cancel
|
||||
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
||||
* Provide an options object to indicate whether `func` 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 debounced function. Subsequent calls
|
||||
* to the debounced function return the result of the last `func` invocation.
|
||||
* Provide `options` to indicate whether `func` 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 debounced function. Subsequent
|
||||
* calls to the debounced function return the result of the last `func`
|
||||
* invocation.
|
||||
*
|
||||
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
|
||||
* on the trailing edge of the timeout only if the debounced function is
|
||||
* invoked more than once during the `wait` timeout.
|
||||
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
||||
* invoked on the trailing edge of the timeout only if the debounced function
|
||||
* 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/)
|
||||
* for details over the differences between `_.debounce` and `_.throttle`.
|
||||
|
||||
@@ -2,7 +2,7 @@ define(['./_baseDifference', './_baseFlatten', './_baseRest', './isArrayLikeObje
|
||||
|
||||
/**
|
||||
* Creates an array of `array` values not included in the other given arrays
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons. The order of result values is determined by the
|
||||
* order they occur in the first array.
|
||||
*
|
||||
|
||||
2
eq.js
2
eq.js
@@ -2,7 +2,7 @@ define([], function() {
|
||||
|
||||
/**
|
||||
* Performs a
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* comparison between two values to determine if they are equivalent.
|
||||
*
|
||||
* @static
|
||||
|
||||
@@ -2,7 +2,7 @@ define(['./toString'], function(toString) {
|
||||
|
||||
/**
|
||||
* Used to match `RegExp`
|
||||
* [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns).
|
||||
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
||||
*/
|
||||
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
|
||||
reHasRegExpChar = RegExp(reRegExpChar.source);
|
||||
|
||||
5
every.js
5
every.js
@@ -8,6 +8,11 @@ define(['./_arrayEvery', './_baseEvery', './_baseIteratee', './isArray', './_isI
|
||||
* Iteration is stopped once `predicate` returns falsey. The predicate is
|
||||
* invoked with three arguments: (value, index|key, collection).
|
||||
*
|
||||
* **Note:** This method returns `true` for
|
||||
* [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
|
||||
* [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
|
||||
* elements of empty collections.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_baseInRange', './toNumber'], function(baseInRange, toNumber) {
|
||||
define(['./_baseInRange', './toFinite', './toNumber'], function(baseInRange, toFinite, toNumber) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -42,12 +42,12 @@ define(['./_baseInRange', './toNumber'], function(baseInRange, toNumber) {
|
||||
* // => true
|
||||
*/
|
||||
function inRange(number, start, end) {
|
||||
start = toNumber(start) || 0;
|
||||
start = toFinite(start);
|
||||
if (end === undefined) {
|
||||
end = start;
|
||||
start = 0;
|
||||
} else {
|
||||
end = toNumber(end) || 0;
|
||||
end = toFinite(end);
|
||||
}
|
||||
number = toNumber(number);
|
||||
return baseInRange(number, start, end);
|
||||
|
||||
@@ -6,7 +6,7 @@ define(['./_baseIndexOf', './isArrayLike', './isString', './toInteger', './value
|
||||
/**
|
||||
* Checks if `value` is in `collection`. If `collection` is a string, it's
|
||||
* checked for a substring of `value`, otherwise
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* is used for equality comparisons. If `fromIndex` is negative, it's used as
|
||||
* the offset from the end of `collection`.
|
||||
*
|
||||
|
||||
@@ -5,7 +5,7 @@ define(['./_baseIndexOf', './toInteger'], function(baseIndexOf, toInteger) {
|
||||
|
||||
/**
|
||||
* Gets the index at which the first occurrence of `value` is found in `array`
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons. If `fromIndex` is negative, it's used as the
|
||||
* offset from the end of `array`.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./dropRight'], function(dropRight) {
|
||||
define(['./_baseSlice'], function(baseSlice) {
|
||||
|
||||
/**
|
||||
* Gets all but the last element of `array`.
|
||||
@@ -15,7 +15,8 @@ define(['./dropRight'], function(dropRight) {
|
||||
* // => [1, 2]
|
||||
*/
|
||||
function initial(array) {
|
||||
return dropRight(array, 1);
|
||||
var length = array ? array.length : 0;
|
||||
return length ? baseSlice(array, 0, -1) : [];
|
||||
}
|
||||
|
||||
return initial;
|
||||
|
||||
@@ -2,7 +2,7 @@ define(['./_arrayMap', './_baseIntersection', './_baseRest', './_castArrayLikeOb
|
||||
|
||||
/**
|
||||
* Creates an array of unique values that are included in all given arrays
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons. The order of result values is determined by the
|
||||
* order they occur in the first array.
|
||||
*
|
||||
|
||||
@@ -11,7 +11,7 @@ define(['./isArrayLikeObject'], function(isArrayLikeObject) {
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_getLength', './isFunction', './isLength'], function(getLength, isFunction, isLength) {
|
||||
define(['./isFunction', './isLength'], function(isFunction, isLength) {
|
||||
|
||||
/**
|
||||
* Checks if `value` is array-like. A value is considered array-like if it's
|
||||
@@ -26,7 +26,7 @@ define(['./_getLength', './isFunction', './isLength'], function(getLength, isFun
|
||||
* // => false
|
||||
*/
|
||||
function isArrayLike(value) {
|
||||
return value != null && isLength(getLength(value)) && !isFunction(value);
|
||||
return value != null && isLength(value.length) && !isFunction(value);
|
||||
}
|
||||
|
||||
return isArrayLike;
|
||||
|
||||
@@ -8,7 +8,7 @@ define(['./isObjectLike'], function(isObjectLike) {
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
define(['./_freeGlobal', './_root', './stubFalse'], function(freeGlobal, root, stubFalse) {
|
||||
define(['./_root', './stubFalse'], function(root, stubFalse) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/** Detect free variable `exports`. */
|
||||
var freeExports = freeGlobal && typeof exports == 'object' && exports;
|
||||
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
||||
|
||||
/** 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`. */
|
||||
var moduleExports = freeModule && freeModule.exports === freeExports;
|
||||
|
||||
@@ -8,8 +8,7 @@ define(['./isObjectLike', './isPlainObject'], function(isObjectLike, isPlainObje
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a DOM element,
|
||||
* else `false`.
|
||||
* @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isElement(document.body);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_getTag', './isArguments', './isArray', './isArrayLike', './isBuffer', './isFunction', './isObjectLike', './isString', './keys'], function(getTag, isArguments, isArray, isArrayLike, isBuffer, isFunction, isObjectLike, isString, keys) {
|
||||
define(['./_getTag', './isArguments', './isArray', './isArrayLike', './isBuffer', './isFunction', './isObjectLike', './_isPrototype', './isString', './_nativeKeys'], function(getTag, isArguments, isArray, isArrayLike, isBuffer, isFunction, isObjectLike, isPrototype, isString, nativeKeys) {
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var mapTag = '[object Map]',
|
||||
@@ -61,12 +61,14 @@ define(['./_getTag', './isArguments', './isArray', './isArrayLike', './isBuffer'
|
||||
return !value.size;
|
||||
}
|
||||
}
|
||||
var isProto = isPrototype(value);
|
||||
for (var key in value) {
|
||||
if (hasOwnProperty.call(value, key)) {
|
||||
if (hasOwnProperty.call(value, key) &&
|
||||
!(isProto && key == 'constructor')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return !(nonEnumShadows && keys(value).length);
|
||||
return !(nonEnumShadows && nativeKeys(value).length);
|
||||
}
|
||||
|
||||
return isEmpty;
|
||||
|
||||
@@ -16,8 +16,7 @@ define(['./_baseIsEqual'], function(baseIsEqual) {
|
||||
* @category Lang
|
||||
* @param {*} value The value to compare.
|
||||
* @param {*} other The other value to compare.
|
||||
* @returns {boolean} Returns `true` if the values are equivalent,
|
||||
* else `false`.
|
||||
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
||||
* @example
|
||||
*
|
||||
* var object = { 'a': 1 };
|
||||
|
||||
@@ -16,8 +16,7 @@ define(['./_baseIsEqual'], function(baseIsEqual) {
|
||||
* @param {*} value The value to compare.
|
||||
* @param {*} other The other value to compare.
|
||||
* @param {Function} [customizer] The function to customize comparisons.
|
||||
* @returns {boolean} Returns `true` if the values are equivalent,
|
||||
* else `false`.
|
||||
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
||||
* @example
|
||||
*
|
||||
* function isGreeting(value) {
|
||||
|
||||
@@ -8,7 +8,7 @@ define(['./isObjectLike'], function(isObjectLike) {
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
@@ -22,8 +22,7 @@ define(['./isObjectLike'], function(isObjectLike) {
|
||||
* @since 3.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is an error object,
|
||||
* else `false`.
|
||||
* @returns {boolean} Returns `true` if `value` is an error object, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isError(new Error);
|
||||
|
||||
@@ -14,8 +14,7 @@ define(['./_root'], function(root) {
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a finite number,
|
||||
* else `false`.
|
||||
* @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isFinite(3);
|
||||
|
||||
@@ -9,7 +9,7 @@ define(['./isObject'], function(isObject) {
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -6,16 +6,15 @@ define([], function() {
|
||||
/**
|
||||
* Checks if `value` is a valid array-like length.
|
||||
*
|
||||
* **Note:** This function is loosely based on
|
||||
* [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
|
||||
* **Note:** This method is loosely based on
|
||||
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a valid length,
|
||||
* else `false`.
|
||||
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isLength(3);
|
||||
|
||||
10
isMatch.js
10
isMatch.js
@@ -2,10 +2,14 @@ define(['./_baseIsMatch', './_getMatchData'], function(baseIsMatch, getMatchData
|
||||
|
||||
/**
|
||||
* Performs a partial deep comparison between `object` and `source` to
|
||||
* determine if `object` contains equivalent property values. This method is
|
||||
* equivalent to a `_.matches` function when `source` is partially applied.
|
||||
* determine if `object` contains equivalent property values.
|
||||
*
|
||||
* **Note:** This method supports comparing the same values as `_.isEqual`.
|
||||
* **Note:** This method is equivalent to `_.matches` when `source` is
|
||||
* partially applied.
|
||||
*
|
||||
* Partial comparisons will match empty array and empty object `source`
|
||||
* values against any array or object value, respectively. See `_.isEqual`
|
||||
* for a list of supported value comparisons.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -8,7 +8,7 @@ define(['./isObjectLike'], function(isObjectLike) {
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -2,7 +2,7 @@ define([], function() {
|
||||
|
||||
/**
|
||||
* Checks if `value` is the
|
||||
* [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types)
|
||||
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
||||
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
||||
*
|
||||
* @static
|
||||
|
||||
@@ -17,7 +17,7 @@ define(['./_getPrototype', './_isHostObject', './isObjectLike'], function(getPro
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
@@ -31,8 +31,7 @@ define(['./_getPrototype', './_isHostObject', './isObjectLike'], function(getPro
|
||||
* @since 0.8.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a plain object,
|
||||
* else `false`.
|
||||
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
||||
* @example
|
||||
*
|
||||
* function Foo() {
|
||||
|
||||
@@ -15,8 +15,7 @@ define(['./isInteger'], function(isInteger) {
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a safe integer,
|
||||
* else `false`.
|
||||
* @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isSafeInteger(3);
|
||||
|
||||
@@ -8,7 +8,7 @@ define(['./isArray', './isObjectLike'], function(isArray, isObjectLike) {
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -8,7 +8,7 @@ define(['./isObjectLike'], function(isObjectLike) {
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -8,7 +8,7 @@ define(['./isObjectLike'], function(isObjectLike) {
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
22
keys.js
22
keys.js
@@ -1,10 +1,10 @@
|
||||
define(['./_baseHas', './_baseKeys', './_indexKeys', './isArrayLike', './_isIndex', './_isPrototype'], function(baseHas, baseKeys, indexKeys, isArrayLike, isIndex, isPrototype) {
|
||||
define(['./_arrayLikeKeys', './_baseKeys', './isArrayLike'], function(arrayLikeKeys, baseKeys, isArrayLike) {
|
||||
|
||||
/**
|
||||
* Creates an array of the own enumerable property names of `object`.
|
||||
*
|
||||
* **Note:** Non-object values are coerced to objects. See the
|
||||
* [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
|
||||
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
||||
* for more details.
|
||||
*
|
||||
* @static
|
||||
@@ -29,23 +29,7 @@ define(['./_baseHas', './_baseKeys', './_indexKeys', './isArrayLike', './_isInde
|
||||
* // => ['0', '1']
|
||||
*/
|
||||
function keys(object) {
|
||||
var isProto = isPrototype(object);
|
||||
if (!(isProto || isArrayLike(object))) {
|
||||
return baseKeys(object);
|
||||
}
|
||||
var indexes = indexKeys(object),
|
||||
skipIndexes = !!indexes,
|
||||
result = indexes || [],
|
||||
length = result.length;
|
||||
|
||||
for (var key in object) {
|
||||
if (baseHas(object, key) &&
|
||||
!(skipIndexes && (key == 'length' || isIndex(key, length))) &&
|
||||
!(isProto && key == 'constructor')) {
|
||||
result.push(key);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
||||
}
|
||||
|
||||
return keys;
|
||||
|
||||
26
keysIn.js
26
keysIn.js
@@ -1,10 +1,4 @@
|
||||
define(['./_baseKeysIn', './_indexKeys', './_isIndex', './_isPrototype'], function(baseKeysIn, indexKeys, isIndex, isPrototype) {
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
define(['./_arrayLikeKeys', './_baseKeysIn', './isArrayLike'], function(arrayLikeKeys, baseKeysIn, isArrayLike) {
|
||||
|
||||
/**
|
||||
* Creates an array of the own and inherited enumerable property names of `object`.
|
||||
@@ -30,23 +24,7 @@ define(['./_baseKeysIn', './_indexKeys', './_isIndex', './_isPrototype'], functi
|
||||
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
||||
*/
|
||||
function keysIn(object) {
|
||||
var index = -1,
|
||||
isProto = isPrototype(object),
|
||||
props = baseKeysIn(object),
|
||||
propsLength = props.length,
|
||||
indexes = indexKeys(object),
|
||||
skipIndexes = !!indexes,
|
||||
result = indexes || [],
|
||||
length = result.length;
|
||||
|
||||
while (++index < propsLength) {
|
||||
var key = props[index];
|
||||
if (!(skipIndexes && (key == 'length' || isIndex(key, length))) &&
|
||||
!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
|
||||
result.push(key);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
||||
}
|
||||
|
||||
return keysIn;
|
||||
|
||||
455
main.js
455
main.js
@@ -13,7 +13,7 @@
|
||||
var undefined;
|
||||
|
||||
/** Used as the semantic version number. */
|
||||
var VERSION = '4.14.0';
|
||||
var VERSION = '4.14.2';
|
||||
|
||||
/** Used as the size to enable large array optimizations. */
|
||||
var LARGE_ARRAY_SIZE = 200;
|
||||
@@ -130,11 +130,12 @@
|
||||
/** Used to match property names within property paths. */
|
||||
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
||||
reIsPlainProp = /^\w*$/,
|
||||
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g;
|
||||
reLeadingDot = /^\./,
|
||||
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
||||
|
||||
/**
|
||||
* Used to match `RegExp`
|
||||
* [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns).
|
||||
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
||||
*/
|
||||
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
|
||||
reHasRegExpChar = RegExp(reRegExpChar.source);
|
||||
@@ -157,7 +158,7 @@
|
||||
|
||||
/**
|
||||
* Used to match
|
||||
* [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components).
|
||||
* [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
|
||||
*/
|
||||
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
|
||||
|
||||
@@ -266,9 +267,9 @@
|
||||
var contextProps = [
|
||||
'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
|
||||
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
|
||||
'Promise', 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError',
|
||||
'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
|
||||
'_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
|
||||
'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
|
||||
'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', '_', 'clearTimeout',
|
||||
'isFinite', 'parseInt', 'setTimeout'
|
||||
];
|
||||
|
||||
/** Used to make template sourceURLs easier to identify. */
|
||||
@@ -371,10 +372,10 @@
|
||||
var root = freeGlobal || freeSelf || Function('return this')();
|
||||
|
||||
/** Detect free variable `exports`. */
|
||||
var freeExports = freeGlobal && typeof exports == 'object' && exports;
|
||||
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
||||
|
||||
/** 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`. */
|
||||
var moduleExports = freeModule && freeModule.exports === freeExports;
|
||||
@@ -1129,7 +1130,7 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a function that invokes `func` with its first argument transformed.
|
||||
* Creates a unary function that invokes `func` with its argument transformed.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to wrap.
|
||||
@@ -1282,7 +1283,6 @@
|
||||
|
||||
/** Built-in constructor references. */
|
||||
var Array = context.Array,
|
||||
Date = context.Date,
|
||||
Error = context.Error,
|
||||
Math = context.Math,
|
||||
RegExp = context.RegExp,
|
||||
@@ -1316,7 +1316,7 @@
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
@@ -1332,29 +1332,28 @@
|
||||
|
||||
/** Built-in value references. */
|
||||
var Buffer = moduleExports ? context.Buffer : undefined,
|
||||
Reflect = context.Reflect,
|
||||
Symbol = context.Symbol,
|
||||
Uint8Array = context.Uint8Array,
|
||||
enumerate = Reflect ? Reflect.enumerate : undefined,
|
||||
getPrototype = overArg(Object.getPrototypeOf, Object),
|
||||
iteratorSymbol = Symbol ? Symbol.iterator : undefined,
|
||||
objectCreate = context.Object.create,
|
||||
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
||||
splice = arrayProto.splice,
|
||||
spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
|
||||
|
||||
/** Built-in method references that are mockable. */
|
||||
var clearTimeout = function(id) { return context.clearTimeout.call(root, id); },
|
||||
setTimeout = function(func, wait) { return context.setTimeout.call(root, func, wait); };
|
||||
/** Mocked built-ins. */
|
||||
var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
|
||||
ctxNow = context.Date && context.Date.now !== root.Date.now && context.Date.now,
|
||||
ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeCeil = Math.ceil,
|
||||
nativeFloor = Math.floor,
|
||||
nativeGetPrototype = Object.getPrototypeOf,
|
||||
nativeGetSymbols = Object.getOwnPropertySymbols,
|
||||
nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
|
||||
nativeIsFinite = context.isFinite,
|
||||
nativeJoin = arrayProto.join,
|
||||
nativeKeys = Object.keys,
|
||||
nativeKeys = overArg(Object.keys, Object),
|
||||
nativeMax = Math.max,
|
||||
nativeMin = Math.min,
|
||||
nativeParseInt = context.parseInt,
|
||||
@@ -2201,6 +2200,31 @@
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Creates an array of the enumerable property names of the array-like `value`.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to query.
|
||||
* @param {boolean} inherited Specify returning inherited property names.
|
||||
* @returns {Array} Returns the array of property names.
|
||||
*/
|
||||
function arrayLikeKeys(value, inherited) {
|
||||
var result = (isArray(value) || isString(value) || isArguments(value))
|
||||
? baseTimes(value.length, String)
|
||||
: [];
|
||||
|
||||
var length = result.length,
|
||||
skipIndexes = !!length;
|
||||
|
||||
for (var key in value) {
|
||||
if ((inherited || hasOwnProperty.call(value, key)) &&
|
||||
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
|
||||
result.push(key);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by `_.defaults` to customize its `_.assignIn` use.
|
||||
*
|
||||
@@ -2237,7 +2261,7 @@
|
||||
|
||||
/**
|
||||
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* @private
|
||||
@@ -2415,9 +2439,6 @@
|
||||
// Recursively populate clone (susceptible to call stack limits).
|
||||
assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
|
||||
});
|
||||
if (!isFull) {
|
||||
stack['delete'](value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2448,14 +2469,13 @@
|
||||
if (object == null) {
|
||||
return !length;
|
||||
}
|
||||
var index = length;
|
||||
while (index--) {
|
||||
var key = props[index],
|
||||
object = Object(object);
|
||||
while (length--) {
|
||||
var key = props[length],
|
||||
predicate = source[key],
|
||||
value = object[key];
|
||||
|
||||
if ((value === undefined &&
|
||||
!(key in Object(object))) || !predicate(value)) {
|
||||
if ((value === undefined && !(key in object)) || !predicate(value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2482,7 +2502,7 @@
|
||||
* @param {Function} func The function to delay.
|
||||
* @param {number} wait The number of milliseconds to delay invocation.
|
||||
* @param {Array} args The arguments to provide to `func`.
|
||||
* @returns {number} Returns the timer id.
|
||||
* @returns {number|Object} Returns the timer id or timeout object.
|
||||
*/
|
||||
function baseDelay(func, wait, args) {
|
||||
if (typeof func != 'function') {
|
||||
@@ -2827,12 +2847,7 @@
|
||||
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
||||
*/
|
||||
function baseHas(object, key) {
|
||||
// Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,
|
||||
// that are composed entirely of index properties, return `false` for
|
||||
// `hasOwnProperty` checks of them.
|
||||
return object != null &&
|
||||
(hasOwnProperty.call(object, key) ||
|
||||
(typeof object == 'object' && key in object && getPrototype(object) === null));
|
||||
return object != null && hasOwnProperty.call(object, key);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3206,40 +3221,47 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.keys` which doesn't skip the constructor
|
||||
* property of prototypes or treat sparse arrays as dense.
|
||||
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array} Returns the array of property names.
|
||||
*/
|
||||
var baseKeys = overArg(nativeKeys, Object);
|
||||
function baseKeys(object) {
|
||||
if (!isPrototype(object)) {
|
||||
return nativeKeys(object);
|
||||
}
|
||||
var result = [];
|
||||
for (var key in Object(object)) {
|
||||
if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
||||
result.push(key);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.keysIn` which doesn't skip the constructor
|
||||
* property of prototypes or treat sparse arrays as dense.
|
||||
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array} Returns the array of property names.
|
||||
*/
|
||||
function baseKeysIn(object) {
|
||||
object = object == null ? object : Object(object);
|
||||
if (!isObject(object)) {
|
||||
return nativeKeysIn(object);
|
||||
}
|
||||
var isProto = isPrototype(object),
|
||||
result = [];
|
||||
|
||||
var result = [];
|
||||
for (var key in object) {
|
||||
result.push(key);
|
||||
if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
|
||||
result.push(key);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Fallback for IE < 9 with es6-shim.
|
||||
if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) {
|
||||
baseKeysIn = function(object) {
|
||||
return iteratorToArray(enumerate(object));
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.lt` which doesn't coerce arguments.
|
||||
*
|
||||
@@ -3324,7 +3346,7 @@
|
||||
return;
|
||||
}
|
||||
if (!(isArray(source) || isTypedArray(source))) {
|
||||
var props = keysIn(source);
|
||||
var props = baseKeysIn(source);
|
||||
}
|
||||
arrayEach(props || source, function(srcValue, key) {
|
||||
if (props) {
|
||||
@@ -3691,6 +3713,9 @@
|
||||
* @returns {Object} Returns `object`.
|
||||
*/
|
||||
function baseSet(object, path, value, customizer) {
|
||||
if (!isObject(object)) {
|
||||
return object;
|
||||
}
|
||||
path = isKey(path, object) ? [path] : castPath(path);
|
||||
|
||||
var index = -1,
|
||||
@@ -3699,20 +3724,19 @@
|
||||
nested = object;
|
||||
|
||||
while (nested != null && ++index < length) {
|
||||
var key = toKey(path[index]);
|
||||
if (isObject(nested)) {
|
||||
var newValue = value;
|
||||
if (index != lastIndex) {
|
||||
var objValue = nested[key];
|
||||
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
||||
if (newValue === undefined) {
|
||||
newValue = objValue == null
|
||||
? (isIndex(path[index + 1]) ? [] : {})
|
||||
: objValue;
|
||||
}
|
||||
var key = toKey(path[index]),
|
||||
newValue = value;
|
||||
|
||||
if (index != lastIndex) {
|
||||
var objValue = nested[key];
|
||||
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
||||
if (newValue === undefined) {
|
||||
newValue = isObject(objValue)
|
||||
? objValue
|
||||
: (isIndex(path[index + 1]) ? [] : {});
|
||||
}
|
||||
assignValue(nested, key, newValue);
|
||||
}
|
||||
assignValue(nested, key, newValue);
|
||||
nested = nested[key];
|
||||
}
|
||||
return object;
|
||||
@@ -4005,7 +4029,7 @@
|
||||
object = parent(object, path);
|
||||
|
||||
var key = toKey(last(path));
|
||||
return !(object != null && baseHas(object, key)) || delete object[key];
|
||||
return !(object != null && hasOwnProperty.call(object, key)) || delete object[key];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4160,6 +4184,16 @@
|
||||
return (!start && end >= length) ? array : baseSlice(array, start, end);
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
|
||||
*
|
||||
* @private
|
||||
* @param {number|Object} id The timer id or timeout object of the timer to clear.
|
||||
*/
|
||||
var clearTimeout = ctxClearTimeout || function(id) {
|
||||
return root.clearTimeout(id);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a clone of `buffer`.
|
||||
*
|
||||
@@ -4653,7 +4687,7 @@
|
||||
function createCtor(Ctor) {
|
||||
return function() {
|
||||
// Use a `switch` statement to work with class constructors. See
|
||||
// http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
|
||||
// http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
|
||||
// for more details.
|
||||
var args = arguments;
|
||||
switch (args.length) {
|
||||
@@ -5009,15 +5043,14 @@
|
||||
end = step = undefined;
|
||||
}
|
||||
// Ensure the sign of `-0` is preserved.
|
||||
start = toNumber(start);
|
||||
start = start === start ? start : 0;
|
||||
start = toFinite(start);
|
||||
if (end === undefined) {
|
||||
end = start;
|
||||
start = 0;
|
||||
} 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);
|
||||
};
|
||||
}
|
||||
@@ -5290,6 +5323,7 @@
|
||||
}
|
||||
}
|
||||
stack['delete'](array);
|
||||
stack['delete'](other);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -5341,7 +5375,7 @@
|
||||
case regexpTag:
|
||||
case stringTag:
|
||||
// Coerce regexes to strings and treat strings, primitives and objects,
|
||||
// as equal. See http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype.tostring
|
||||
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
|
||||
// for more details.
|
||||
return object == (other + '');
|
||||
|
||||
@@ -5403,7 +5437,7 @@
|
||||
var index = objLength;
|
||||
while (index--) {
|
||||
var key = objProps[index];
|
||||
if (!(isPartial ? key in other : baseHas(other, key))) {
|
||||
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -5450,6 +5484,7 @@
|
||||
}
|
||||
}
|
||||
stack['delete'](object);
|
||||
stack['delete'](other);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -5538,19 +5573,6 @@
|
||||
return arguments.length ? result(arguments[0], arguments[1]) : result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the "length" property value of `object`.
|
||||
*
|
||||
* **Note:** This function is used to avoid a
|
||||
* [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects
|
||||
* Safari on at least iOS 8.1-8.3 ARM64.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {*} Returns the "length" value.
|
||||
*/
|
||||
var getLength = baseProperty('length');
|
||||
|
||||
/**
|
||||
* Gets the data for `map`.
|
||||
*
|
||||
@@ -5599,15 +5621,6 @@
|
||||
return baseIsNative(value) ? value : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the `[[Prototype]]` of `value`.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to query.
|
||||
* @returns {null|Object} Returns the `[[Prototype]]`.
|
||||
*/
|
||||
var getPrototype = overArg(nativeGetPrototype, Object);
|
||||
|
||||
/**
|
||||
* Creates an array of the own enumerable symbol properties of `object`.
|
||||
*
|
||||
@@ -5625,7 +5638,7 @@
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array} Returns the array of symbols.
|
||||
*/
|
||||
var getSymbolsIn = !nativeGetSymbols ? getSymbols : function(object) {
|
||||
var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
|
||||
var result = [];
|
||||
while (object) {
|
||||
arrayPush(result, getSymbols(object));
|
||||
@@ -5820,23 +5833,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array of index keys for `object` values of arrays,
|
||||
* `arguments` objects, and strings, otherwise `null` is returned.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array|null} Returns index keys, else `null`.
|
||||
*/
|
||||
function indexKeys(object) {
|
||||
var length = object ? object.length : undefined;
|
||||
if (isLength(length) &&
|
||||
(isArray(object) || isString(object) || isArguments(object))) {
|
||||
return baseTimes(length, String);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts wrapper `details` in a comment at the top of the `source` body.
|
||||
*
|
||||
@@ -5863,7 +5859,7 @@
|
||||
*/
|
||||
function isFlattenable(value) {
|
||||
return isArray(value) || isArguments(value) ||
|
||||
!!(spreadableSymbol && value && value[spreadableSymbol])
|
||||
!!(spreadableSymbol && value && value[spreadableSymbol]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6121,6 +6117,25 @@
|
||||
return objValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is like
|
||||
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
||||
* except that it includes inherited enumerable properties.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array} Returns the array of property names.
|
||||
*/
|
||||
function nativeKeysIn(object) {
|
||||
var result = [];
|
||||
if (object != null) {
|
||||
for (var key in Object(object)) {
|
||||
result.push(key);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the parent value at `path` of `object`.
|
||||
*
|
||||
@@ -6189,6 +6204,18 @@
|
||||
};
|
||||
}());
|
||||
|
||||
/**
|
||||
* A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to delay.
|
||||
* @param {number} wait The number of milliseconds to delay invocation.
|
||||
* @returns {number|Object} Returns the timer id or timeout object.
|
||||
*/
|
||||
var setTimeout = ctxSetTimeout || function(func, wait) {
|
||||
return root.setTimeout(func, wait);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the `toString` method of `wrapper` to mimic the source of `reference`
|
||||
* with wrapper details in a comment at the top of the source body.
|
||||
@@ -6216,8 +6243,13 @@
|
||||
* @returns {Array} Returns the property path array.
|
||||
*/
|
||||
var stringToPath = memoize(function(string) {
|
||||
string = toString(string);
|
||||
|
||||
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));
|
||||
});
|
||||
return result;
|
||||
@@ -6404,7 +6436,7 @@
|
||||
|
||||
/**
|
||||
* Creates an array of `array` values not included in the other given arrays
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons. The order of result values is determined by the
|
||||
* order they occur in the first array.
|
||||
*
|
||||
@@ -6907,7 +6939,7 @@
|
||||
|
||||
/**
|
||||
* Gets the index at which the first occurrence of `value` is found in `array`
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons. If `fromIndex` is negative, it's used as the
|
||||
* offset from the end of `array`.
|
||||
*
|
||||
@@ -6955,12 +6987,13 @@
|
||||
* // => [1, 2]
|
||||
*/
|
||||
function initial(array) {
|
||||
return dropRight(array, 1);
|
||||
var length = array ? array.length : 0;
|
||||
return length ? baseSlice(array, 0, -1) : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array of unique values that are included in all given arrays
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons. The order of result values is determined by the
|
||||
* order they occur in the first array.
|
||||
*
|
||||
@@ -7164,7 +7197,7 @@
|
||||
|
||||
/**
|
||||
* Removes all given values from `array` using
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
|
||||
@@ -7633,7 +7666,8 @@
|
||||
* // => [2, 3]
|
||||
*/
|
||||
function tail(array) {
|
||||
return drop(array, 1);
|
||||
var length = array ? array.length : 0;
|
||||
return length ? baseSlice(array, 1, length) : [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -7790,7 +7824,7 @@
|
||||
|
||||
/**
|
||||
* Creates an array of unique values, in order, from all given arrays using
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* @static
|
||||
@@ -7871,7 +7905,7 @@
|
||||
|
||||
/**
|
||||
* Creates a duplicate-free version of an array, using
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons, in which only the first occurrence of each
|
||||
* element is kept.
|
||||
*
|
||||
@@ -8016,7 +8050,7 @@
|
||||
|
||||
/**
|
||||
* Creates an array excluding all given values using
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* **Note:** Unlike `_.pull`, this method returns a new array.
|
||||
@@ -8587,6 +8621,11 @@
|
||||
* Iteration is stopped once `predicate` returns falsey. The predicate is
|
||||
* invoked with three arguments: (value, index|key, collection).
|
||||
*
|
||||
* **Note:** This method returns `true` for
|
||||
* [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
|
||||
* [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
|
||||
* elements of empty collections.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
@@ -8904,7 +8943,7 @@
|
||||
/**
|
||||
* Checks if `value` is in `collection`. If `collection` is a string, it's
|
||||
* checked for a substring of `value`, otherwise
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* is used for equality comparisons. If `fromIndex` is negative, it's used as
|
||||
* the offset from the end of `collection`.
|
||||
*
|
||||
@@ -9372,7 +9411,7 @@
|
||||
return collection.size;
|
||||
}
|
||||
}
|
||||
return keys(collection).length;
|
||||
return baseKeys(collection).length;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -9484,9 +9523,9 @@
|
||||
* }, _.now());
|
||||
* // => Logs the number of milliseconds it took for the deferred invocation.
|
||||
*/
|
||||
function now() {
|
||||
return Date.now();
|
||||
}
|
||||
var now = ctxNow || function() {
|
||||
return root.Date.now();
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
@@ -9779,14 +9818,18 @@
|
||||
* milliseconds have elapsed since the last time the debounced function was
|
||||
* invoked. The debounced function comes with a `cancel` method to cancel
|
||||
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
||||
* Provide an options object to indicate whether `func` 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 debounced function. Subsequent calls
|
||||
* to the debounced function return the result of the last `func` invocation.
|
||||
* Provide `options` to indicate whether `func` 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 debounced function. Subsequent
|
||||
* calls to the debounced function return the result of the last `func`
|
||||
* invocation.
|
||||
*
|
||||
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
|
||||
* on the trailing edge of the timeout only if the debounced function is
|
||||
* invoked more than once during the `wait` timeout.
|
||||
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
||||
* invoked on the trailing edge of the timeout only if the debounced function
|
||||
* 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/)
|
||||
* for details over the differences between `_.debounce` and `_.throttle`.
|
||||
@@ -10023,7 +10066,7 @@
|
||||
* **Note:** The cache is exposed as the `cache` property on the memoized
|
||||
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
||||
* constructor with one whose instances implement the
|
||||
* [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)
|
||||
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
||||
* method interface of `delete`, `get`, `has`, and `set`.
|
||||
*
|
||||
* @static
|
||||
@@ -10323,7 +10366,7 @@
|
||||
/**
|
||||
* Creates a function that invokes `func` with the `this` binding of the
|
||||
* create function and an array of arguments much like
|
||||
* [`Function#apply`](http://www.ecma-international.org/ecma-262/6.0/#sec-function.prototype.apply).
|
||||
* [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
|
||||
*
|
||||
* **Note:** This method is based on the
|
||||
* [spread operator](https://mdn.io/spread_operator).
|
||||
@@ -10374,8 +10417,8 @@
|
||||
* Creates a throttled function that only invokes `func` at most once per
|
||||
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
||||
* method to cancel delayed `func` invocations and a `flush` method to
|
||||
* immediately invoke them. Provide an options object to indicate whether
|
||||
* `func` should be invoked on the leading and/or trailing edge of the `wait`
|
||||
* immediately invoke them. Provide `options` to indicate whether `func`
|
||||
* 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
|
||||
* throttled function. Subsequent calls to the throttled function return the
|
||||
* result of the last `func` invocation.
|
||||
@@ -10384,6 +10427,9 @@
|
||||
* invoked on the trailing edge of the timeout only if the throttled function
|
||||
* 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/)
|
||||
* for details over the differences between `_.throttle` and `_.debounce`.
|
||||
*
|
||||
@@ -10638,9 +10684,11 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `object` conforms to `source` by invoking the predicate properties
|
||||
* of `source` with the corresponding property values of `object`. This method
|
||||
* is equivalent to a `_.conforms` function when `source` is partially applied.
|
||||
* Checks if `object` conforms to `source` by invoking the predicate
|
||||
* properties of `source` with the corresponding property values of `object`.
|
||||
*
|
||||
* **Note:** This method is equivalent to `_.conforms` when `source` is
|
||||
* partially applied.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -10665,7 +10713,7 @@
|
||||
|
||||
/**
|
||||
* Performs a
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* comparison between two values to determine if they are equivalent.
|
||||
*
|
||||
* @static
|
||||
@@ -10845,7 +10893,7 @@
|
||||
* // => false
|
||||
*/
|
||||
function isArrayLike(value) {
|
||||
return value != null && isLength(getLength(value)) && !isFunction(value);
|
||||
return value != null && isLength(value.length) && !isFunction(value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -10945,8 +10993,7 @@
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a DOM element,
|
||||
* else `false`.
|
||||
* @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isElement(document.body);
|
||||
@@ -11004,12 +11051,14 @@
|
||||
return !value.size;
|
||||
}
|
||||
}
|
||||
var isProto = isPrototype(value);
|
||||
for (var key in value) {
|
||||
if (hasOwnProperty.call(value, key)) {
|
||||
if (hasOwnProperty.call(value, key) &&
|
||||
!(isProto && key == 'constructor')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return !(nonEnumShadows && keys(value).length);
|
||||
return !(nonEnumShadows && nativeKeys(value).length);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -11028,8 +11077,7 @@
|
||||
* @category Lang
|
||||
* @param {*} value The value to compare.
|
||||
* @param {*} other The other value to compare.
|
||||
* @returns {boolean} Returns `true` if the values are equivalent,
|
||||
* else `false`.
|
||||
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
||||
* @example
|
||||
*
|
||||
* var object = { 'a': 1 };
|
||||
@@ -11058,8 +11106,7 @@
|
||||
* @param {*} value The value to compare.
|
||||
* @param {*} other The other value to compare.
|
||||
* @param {Function} [customizer] The function to customize comparisons.
|
||||
* @returns {boolean} Returns `true` if the values are equivalent,
|
||||
* else `false`.
|
||||
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
||||
* @example
|
||||
*
|
||||
* function isGreeting(value) {
|
||||
@@ -11093,8 +11140,7 @@
|
||||
* @since 3.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is an error object,
|
||||
* else `false`.
|
||||
* @returns {boolean} Returns `true` if `value` is an error object, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isError(new Error);
|
||||
@@ -11122,8 +11168,7 @@
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a finite number,
|
||||
* else `false`.
|
||||
* @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isFinite(3);
|
||||
@@ -11200,16 +11245,15 @@
|
||||
/**
|
||||
* Checks if `value` is a valid array-like length.
|
||||
*
|
||||
* **Note:** This function is loosely based on
|
||||
* [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
|
||||
* **Note:** This method is loosely based on
|
||||
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a valid length,
|
||||
* else `false`.
|
||||
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isLength(3);
|
||||
@@ -11231,7 +11275,7 @@
|
||||
|
||||
/**
|
||||
* Checks if `value` is the
|
||||
* [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types)
|
||||
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
||||
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
||||
*
|
||||
* @static
|
||||
@@ -11308,10 +11352,14 @@
|
||||
|
||||
/**
|
||||
* Performs a partial deep comparison between `object` and `source` to
|
||||
* determine if `object` contains equivalent property values. This method is
|
||||
* equivalent to a `_.matches` function when `source` is partially applied.
|
||||
* determine if `object` contains equivalent property values.
|
||||
*
|
||||
* **Note:** This method supports comparing the same values as `_.isEqual`.
|
||||
* **Note:** This method is equivalent to `_.matches` when `source` is
|
||||
* partially applied.
|
||||
*
|
||||
* Partial comparisons will match empty array and empty object `source`
|
||||
* values against any array or object value, respectively. See `_.isEqual`
|
||||
* for a list of supported value comparisons.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -11524,8 +11572,7 @@
|
||||
* @since 0.8.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a plain object,
|
||||
* else `false`.
|
||||
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
||||
* @example
|
||||
*
|
||||
* function Foo() {
|
||||
@@ -11589,8 +11636,7 @@
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a safe integer,
|
||||
* else `false`.
|
||||
* @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isSafeInteger(3);
|
||||
@@ -11884,7 +11930,7 @@
|
||||
* Converts `value` to an integer.
|
||||
*
|
||||
* **Note:** This method is loosely based on
|
||||
* [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
|
||||
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -11918,7 +11964,7 @@
|
||||
* array-like object.
|
||||
*
|
||||
* **Note:** This method is based on
|
||||
* [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
|
||||
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -12147,13 +12193,7 @@
|
||||
* // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
|
||||
*/
|
||||
var assignIn = createAssigner(function(object, source) {
|
||||
if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {
|
||||
copyObject(source, keysIn(source), object);
|
||||
return;
|
||||
}
|
||||
for (var key in source) {
|
||||
assignValue(object, key, source[key]);
|
||||
}
|
||||
copyObject(source, keysIn(source), object);
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -12762,7 +12802,7 @@
|
||||
* Creates an array of the own enumerable property names of `object`.
|
||||
*
|
||||
* **Note:** Non-object values are coerced to objects. See the
|
||||
* [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
|
||||
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
||||
* for more details.
|
||||
*
|
||||
* @static
|
||||
@@ -12787,23 +12827,7 @@
|
||||
* // => ['0', '1']
|
||||
*/
|
||||
function keys(object) {
|
||||
var isProto = isPrototype(object);
|
||||
if (!(isProto || isArrayLike(object))) {
|
||||
return baseKeys(object);
|
||||
}
|
||||
var indexes = indexKeys(object),
|
||||
skipIndexes = !!indexes,
|
||||
result = indexes || [],
|
||||
length = result.length;
|
||||
|
||||
for (var key in object) {
|
||||
if (baseHas(object, key) &&
|
||||
!(skipIndexes && (key == 'length' || isIndex(key, length))) &&
|
||||
!(isProto && key == 'constructor')) {
|
||||
result.push(key);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -12830,23 +12854,7 @@
|
||||
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
||||
*/
|
||||
function keysIn(object) {
|
||||
var index = -1,
|
||||
isProto = isPrototype(object),
|
||||
props = baseKeysIn(object),
|
||||
propsLength = props.length,
|
||||
indexes = indexKeys(object),
|
||||
skipIndexes = !!indexes,
|
||||
result = indexes || [],
|
||||
length = result.length;
|
||||
|
||||
while (++index < propsLength) {
|
||||
var key = props[index];
|
||||
if (!(skipIndexes && (key == 'length' || isIndex(key, length))) &&
|
||||
!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
|
||||
result.push(key);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13523,12 +13531,12 @@
|
||||
* // => true
|
||||
*/
|
||||
function inRange(number, start, end) {
|
||||
start = toNumber(start) || 0;
|
||||
start = toFinite(start);
|
||||
if (end === undefined) {
|
||||
end = start;
|
||||
start = 0;
|
||||
} else {
|
||||
end = toNumber(end) || 0;
|
||||
end = toFinite(end);
|
||||
}
|
||||
number = toNumber(number);
|
||||
return baseInRange(number, start, end);
|
||||
@@ -13584,12 +13592,12 @@
|
||||
upper = 1;
|
||||
}
|
||||
else {
|
||||
lower = toNumber(lower) || 0;
|
||||
lower = toFinite(lower);
|
||||
if (upper === undefined) {
|
||||
upper = lower;
|
||||
lower = 0;
|
||||
} else {
|
||||
upper = toNumber(upper) || 0;
|
||||
upper = toFinite(upper);
|
||||
}
|
||||
}
|
||||
if (lower > upper) {
|
||||
@@ -14836,6 +14844,9 @@
|
||||
* the corresponding property values of a given object, returning `true` if
|
||||
* all predicates return truthy, else `false`.
|
||||
*
|
||||
* **Note:** The created function is equivalent to `_.conformsTo` with
|
||||
* `source` partially applied.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
@@ -15021,10 +15032,14 @@
|
||||
/**
|
||||
* Creates a function that performs a partial deep comparison between a given
|
||||
* object and `source`, returning `true` if the given object has equivalent
|
||||
* property values, else `false`. The created function is equivalent to
|
||||
* `_.isMatch` with a `source` partially applied.
|
||||
* property values, else `false`.
|
||||
*
|
||||
* **Note:** This method supports comparing the same values as `_.isEqual`.
|
||||
* **Note:** The created function is equivalent to `_.isMatch` with `source`
|
||||
* partially applied.
|
||||
*
|
||||
* Partial comparisons will match empty array and empty object `source`
|
||||
* values against any array or object value, respectively. See `_.isEqual`
|
||||
* for a list of supported value comparisons.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -15051,7 +15066,9 @@
|
||||
* value at `path` of a given object to `srcValue`, returning `true` if the
|
||||
* object value is equivalent, else `false`.
|
||||
*
|
||||
* **Note:** This method supports comparing the same values as `_.isEqual`.
|
||||
* **Note:** Partial comparisons will match empty array and empty object
|
||||
* `srcValue` values against any array or object value, respectively. See
|
||||
* `_.isEqual` for a list of supported value comparisons.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
10
matches.js
10
matches.js
@@ -3,10 +3,14 @@ define(['./_baseClone', './_baseMatches'], function(baseClone, baseMatches) {
|
||||
/**
|
||||
* Creates a function that performs a partial deep comparison between a given
|
||||
* object and `source`, returning `true` if the given object has equivalent
|
||||
* property values, else `false`. The created function is equivalent to
|
||||
* `_.isMatch` with a `source` partially applied.
|
||||
* property values, else `false`.
|
||||
*
|
||||
* **Note:** This method supports comparing the same values as `_.isEqual`.
|
||||
* **Note:** The created function is equivalent to `_.isMatch` with `source`
|
||||
* partially applied.
|
||||
*
|
||||
* Partial comparisons will match empty array and empty object `source`
|
||||
* values against any array or object value, respectively. See `_.isEqual`
|
||||
* for a list of supported value comparisons.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -5,7 +5,9 @@ define(['./_baseClone', './_baseMatchesProperty'], function(baseClone, baseMatch
|
||||
* value at `path` of a given object to `srcValue`, returning `true` if the
|
||||
* object value is equivalent, else `false`.
|
||||
*
|
||||
* **Note:** This method supports comparing the same values as `_.isEqual`.
|
||||
* **Note:** Partial comparisons will match empty array and empty object
|
||||
* `srcValue` values against any array or object value, respectively. See
|
||||
* `_.isEqual` for a list of supported value comparisons.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -13,7 +13,7 @@ define(['./_MapCache'], function(MapCache) {
|
||||
* **Note:** The cache is exposed as the `cache` property on the memoized
|
||||
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
||||
* constructor with one whose instances implement the
|
||||
* [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)
|
||||
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
||||
* method interface of `delete`, `get`, `has`, and `set`.
|
||||
*
|
||||
* @static
|
||||
|
||||
8
now.js
8
now.js
@@ -1,4 +1,4 @@
|
||||
define([], function() {
|
||||
define(['./_root'], function(root) {
|
||||
|
||||
/**
|
||||
* Gets the timestamp of the number of milliseconds that have elapsed since
|
||||
@@ -16,9 +16,9 @@ define([], function() {
|
||||
* }, _.now());
|
||||
* // => Logs the number of milliseconds it took for the deferred invocation.
|
||||
*/
|
||||
function now() {
|
||||
return Date.now();
|
||||
}
|
||||
var now = function() {
|
||||
return root.Date.now();
|
||||
};
|
||||
|
||||
return now;
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lodash-amd",
|
||||
"version": "4.14.0",
|
||||
"version": "4.14.2",
|
||||
"description": "Lodash exported as AMD modules.",
|
||||
"keywords": "amd, modules, stdlib, util",
|
||||
"homepage": "https://lodash.com/custom-builds",
|
||||
|
||||
2
pull.js
2
pull.js
@@ -2,7 +2,7 @@ define(['./_baseRest', './pullAll'], function(baseRest, pullAll) {
|
||||
|
||||
/**
|
||||
* Removes all given values from `array` using
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_baseRandom', './_isIterateeCall', './toNumber'], function(baseRandom, isIterateeCall, toNumber) {
|
||||
define(['./_baseRandom', './_isIterateeCall', './toFinite'], function(baseRandom, isIterateeCall, toFinite) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -60,12 +60,12 @@ define(['./_baseRandom', './_isIterateeCall', './toNumber'], function(baseRandom
|
||||
upper = 1;
|
||||
}
|
||||
else {
|
||||
lower = toNumber(lower) || 0;
|
||||
lower = toFinite(lower);
|
||||
if (upper === undefined) {
|
||||
upper = lower;
|
||||
lower = 0;
|
||||
} else {
|
||||
upper = toNumber(upper) || 0;
|
||||
upper = toFinite(upper);
|
||||
}
|
||||
}
|
||||
if (lower > upper) {
|
||||
|
||||
4
size.js
4
size.js
@@ -1,4 +1,4 @@
|
||||
define(['./_getTag', './isArrayLike', './isObjectLike', './isString', './keys', './_stringSize'], function(getTag, isArrayLike, isObjectLike, isString, keys, stringSize) {
|
||||
define(['./_baseKeys', './_getTag', './isArrayLike', './isObjectLike', './isString', './_stringSize'], function(baseKeys, getTag, isArrayLike, isObjectLike, isString, stringSize) {
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var mapTag = '[object Map]',
|
||||
@@ -39,7 +39,7 @@ define(['./_getTag', './isArrayLike', './isObjectLike', './isString', './keys',
|
||||
return collection.size;
|
||||
}
|
||||
}
|
||||
return keys(collection).length;
|
||||
return baseKeys(collection).length;
|
||||
}
|
||||
|
||||
return size;
|
||||
|
||||
@@ -12,7 +12,7 @@ define(['./_apply', './_arrayPush', './_baseRest', './_castSlice', './toInteger'
|
||||
/**
|
||||
* Creates a function that invokes `func` with the `this` binding of the
|
||||
* create function and an array of arguments much like
|
||||
* [`Function#apply`](http://www.ecma-international.org/ecma-262/6.0/#sec-function.prototype.apply).
|
||||
* [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
|
||||
*
|
||||
* **Note:** This method is based on the
|
||||
* [spread operator](https://mdn.io/spread_operator).
|
||||
|
||||
5
tail.js
5
tail.js
@@ -1,4 +1,4 @@
|
||||
define(['./drop'], function(drop) {
|
||||
define(['./_baseSlice'], function(baseSlice) {
|
||||
|
||||
/**
|
||||
* Gets all but the first element of `array`.
|
||||
@@ -15,7 +15,8 @@ define(['./drop'], function(drop) {
|
||||
* // => [2, 3]
|
||||
*/
|
||||
function tail(array) {
|
||||
return drop(array, 1);
|
||||
var length = array ? array.length : 0;
|
||||
return length ? baseSlice(array, 1, length) : [];
|
||||
}
|
||||
|
||||
return tail;
|
||||
|
||||
@@ -10,7 +10,7 @@ define(['./_assignInDefaults', './assignInWith', './attempt', './_baseValues', '
|
||||
|
||||
/**
|
||||
* Used to match
|
||||
* [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components).
|
||||
* [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
|
||||
*/
|
||||
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ define(['./debounce', './isObject'], function(debounce, isObject) {
|
||||
* Creates a throttled function that only invokes `func` at most once per
|
||||
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
||||
* method to cancel delayed `func` invocations and a `flush` method to
|
||||
* immediately invoke them. Provide an options object to indicate whether
|
||||
* `func` should be invoked on the leading and/or trailing edge of the `wait`
|
||||
* immediately invoke them. Provide `options` to indicate whether `func`
|
||||
* 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
|
||||
* throttled function. Subsequent calls to the throttled function return the
|
||||
* result of the last `func` invocation.
|
||||
@@ -17,6 +17,9 @@ define(['./debounce', './isObject'], function(debounce, isObject) {
|
||||
* invoked on the trailing edge of the timeout only if the throttled function
|
||||
* 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/)
|
||||
* for details over the differences between `_.throttle` and `_.debounce`.
|
||||
*
|
||||
|
||||
@@ -4,7 +4,7 @@ define(['./toFinite'], function(toFinite) {
|
||||
* Converts `value` to an integer.
|
||||
*
|
||||
* **Note:** This method is loosely based on
|
||||
* [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
|
||||
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -8,7 +8,7 @@ define(['./_baseClamp', './toInteger'], function(baseClamp, toInteger) {
|
||||
* array-like object.
|
||||
*
|
||||
* **Note:** This method is based on
|
||||
* [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
|
||||
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
2
union.js
2
union.js
@@ -2,7 +2,7 @@ define(['./_baseFlatten', './_baseRest', './_baseUniq', './isArrayLikeObject'],
|
||||
|
||||
/**
|
||||
* Creates an array of unique values, in order, from all given arrays using
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* @static
|
||||
|
||||
2
uniq.js
2
uniq.js
@@ -2,7 +2,7 @@ define(['./_baseUniq'], function(baseUniq) {
|
||||
|
||||
/**
|
||||
* Creates a duplicate-free version of an array, using
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons, in which only the first occurrence of each
|
||||
* element is kept.
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@ define(['./_baseDifference', './_baseRest', './isArrayLikeObject'], function(bas
|
||||
|
||||
/**
|
||||
* Creates an array excluding all given values using
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* **Note:** Unlike `_.pull`, this method returns a new array.
|
||||
|
||||
Reference in New Issue
Block a user