Compare commits

...

2 Commits

Author SHA1 Message Date
John-David Dalton
3d3ce0979f Bump to v4.14.2. 2016-08-07 21:21:03 -07:00
John-David Dalton
623a72a129 Bump to v4.14.1. 2016-07-28 23:38:46 -07:00
88 changed files with 522 additions and 509 deletions

View File

@@ -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. 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.

View File

@@ -1,7 +0,0 @@
define(['./_root'], function(root) {
/** Built-in value references. */
var Reflect = root.Reflect;
return Reflect;
});

35
_arrayLikeKeys.js Normal file
View 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;
});

View File

@@ -11,7 +11,7 @@ define(['./eq'], function(eq) {
/** /**
* Assigns `value` to `key` of `object` if the existing value is not equivalent * 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. * for equality comparisons.
* *
* @private * @private

View File

@@ -120,9 +120,6 @@ define(['./_Stack', './_arrayEach', './_assignValue', './_baseAssign', './_clone
// Recursively populate clone (susceptible to call stack limits). // Recursively populate clone (susceptible to call stack limits).
assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack)); assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
}); });
if (!isFull) {
stack['delete'](value);
}
return result; return result;
} }

View File

@@ -16,14 +16,13 @@ define([], function() {
if (object == null) { if (object == null) {
return !length; return !length;
} }
var index = length; object = Object(object);
while (index--) { while (length--) {
var key = props[index], var key = props[length],
predicate = source[key], predicate = source[key],
value = object[key]; value = object[key];
if ((value === undefined && if ((value === undefined && !(key in object)) || !predicate(value)) {
!(key in Object(object))) || !predicate(value)) {
return false; return false;
} }
} }

View File

@@ -14,7 +14,7 @@ define([], function() {
* @param {Function} func The function to delay. * @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay invocation. * @param {number} wait The number of milliseconds to delay invocation.
* @param {Array} args The arguments to provide to `func`. * @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) { function baseDelay(func, wait, args) {
if (typeof func != 'function') { if (typeof func != 'function') {

View File

@@ -5,7 +5,7 @@ define([], function() {
/** /**
* Used to resolve the * 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -1,4 +1,4 @@
define(['./_getPrototype'], function(getPrototype) { define([], function() {
/** Used for built-in method references. */ /** Used for built-in method references. */
var objectProto = Object.prototype; var objectProto = Object.prototype;
@@ -15,12 +15,7 @@ define(['./_getPrototype'], function(getPrototype) {
* @returns {boolean} Returns `true` if `key` exists, else `false`. * @returns {boolean} Returns `true` if `key` exists, else `false`.
*/ */
function baseHas(object, key) { function baseHas(object, key) {
// Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, return object != null && hasOwnProperty.call(object, key);
// 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 baseHas; return baseHas;

View File

@@ -7,7 +7,7 @@ define(['./isObjectLike'], function(isObjectLike) {
/** /**
* Used to resolve the * 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -8,7 +8,7 @@ define(['./isObjectLike'], function(isObjectLike) {
/** /**
* Used to resolve the * 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -2,7 +2,7 @@ define(['./isFunction', './_isHostObject', './_isMasked', './isObject', './_toSo
/** /**
* Used to match `RegExp` * 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; var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;

View File

@@ -8,7 +8,7 @@ define(['./isObject'], function(isObject) {
/** /**
* Used to resolve the * 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -48,7 +48,7 @@ define(['./isLength', './isObjectLike'], function(isLength, isObjectLike) {
/** /**
* Used to resolve the * 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -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. */ /** Used for built-in method references. */
var nativeKeys = Object.keys; 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 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
* property of prototypes or treat sparse arrays as dense.
* *
* @private * @private
* @param {Object} object The object to query. * @param {Object} object The object to query.
* @returns {Array} Returns the array of property names. * @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; return baseKeys;
}); });

View File

@@ -1,39 +1,32 @@
define(['./_Reflect', './_iteratorToArray'], function(Reflect, iteratorToArray) { define(['./isObject', './_isPrototype', './_nativeKeysIn'], function(isObject, isPrototype, nativeKeysIn) {
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined;
/** Used for built-in method references. */ /** Used for built-in method references. */
var objectProto = Object.prototype; var objectProto = Object.prototype;
/** Built-in value references. */ /** Used to check objects for own properties. */
var enumerate = Reflect ? Reflect.enumerate : undefined, var hasOwnProperty = objectProto.hasOwnProperty;
propertyIsEnumerable = objectProto.propertyIsEnumerable;
/** /**
* The base implementation of `_.keysIn` which doesn't skip the constructor * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
* property of prototypes or treat sparse arrays as dense.
* *
* @private * @private
* @param {Object} object The object to query. * @param {Object} object The object to query.
* @returns {Array} Returns the array of property names. * @returns {Array} Returns the array of property names.
*/ */
function baseKeysIn(object) { 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) { for (var key in object) {
result.push(key); if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
}
} }
return result; 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; return baseKeysIn;
}); });

View File

@@ -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. */ /** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined; var undefined;
@@ -19,7 +19,7 @@ define(['./_Stack', './_arrayEach', './_assignMergeValue', './_baseMergeDeep', '
return; return;
} }
if (!(isArray(source) || isTypedArray(source))) { if (!(isArray(source) || isTypedArray(source))) {
var props = keysIn(source); var props = baseKeysIn(source);
} }
arrayEach(props || source, function(srcValue, key) { arrayEach(props || source, function(srcValue, key) {
if (props) { if (props) {

View File

@@ -14,6 +14,9 @@ define(['./_assignValue', './_castPath', './_isIndex', './_isKey', './isObject',
* @returns {Object} Returns `object`. * @returns {Object} Returns `object`.
*/ */
function baseSet(object, path, value, customizer) { function baseSet(object, path, value, customizer) {
if (!isObject(object)) {
return object;
}
path = isKey(path, object) ? [path] : castPath(path); path = isKey(path, object) ? [path] : castPath(path);
var index = -1, var index = -1,
@@ -22,20 +25,19 @@ define(['./_assignValue', './_castPath', './_isIndex', './_isKey', './isObject',
nested = object; nested = object;
while (nested != null && ++index < length) { while (nested != null && ++index < length) {
var key = toKey(path[index]); var key = toKey(path[index]),
if (isObject(nested)) { newValue = value;
var newValue = value;
if (index != lastIndex) { if (index != lastIndex) {
var objValue = nested[key]; var objValue = nested[key];
newValue = customizer ? customizer(objValue, key, nested) : undefined; newValue = customizer ? customizer(objValue, key, nested) : undefined;
if (newValue === undefined) { if (newValue === undefined) {
newValue = objValue == null newValue = isObject(objValue)
? (isIndex(path[index + 1]) ? [] : {}) ? objValue
: objValue; : (isIndex(path[index + 1]) ? [] : {});
}
} }
assignValue(nested, key, newValue);
} }
assignValue(nested, key, newValue);
nested = nested[key]; nested = nested[key];
} }
return object; return object;

View File

@@ -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`. * The base implementation of `_.unset`.
@@ -13,7 +19,7 @@ define(['./_baseHas', './_castPath', './_isKey', './last', './_parent', './_toKe
object = parent(object, path); object = parent(object, path);
var key = toKey(last(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; return baseUnset;

View File

@@ -11,7 +11,7 @@ define(['./_baseCreate', './isObject'], function(baseCreate, isObject) {
function createCtor(Ctor) { function createCtor(Ctor) {
return function() { return function() {
// Use a `switch` statement to work with class constructors. See // 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. // for more details.
var args = arguments; var args = arguments;
switch (args.length) { switch (args.length) {

View File

@@ -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. */ /** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined; var undefined;
@@ -16,15 +16,14 @@ define(['./_baseRange', './_isIterateeCall', './toNumber'], function(baseRange,
end = step = undefined; end = step = undefined;
} }
// Ensure the sign of `-0` is preserved. // Ensure the sign of `-0` is preserved.
start = toNumber(start); start = toFinite(start);
start = start === start ? start : 0;
if (end === undefined) { if (end === undefined) {
end = start; end = start;
start = 0; start = 0;
} else { } else {
end = toNumber(end) || 0; end = toFinite(end);
} }
step = step === undefined ? (start < end ? 1 : -1) : (toNumber(step) || 0); step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
return baseRange(start, end, step, fromRight); return baseRange(start, end, step, fromRight);
}; };
} }

View File

@@ -78,6 +78,7 @@ define(['./_SetCache', './_arraySome'], function(SetCache, arraySome) {
} }
} }
stack['delete'](array); stack['delete'](array);
stack['delete'](other);
return result; return result;
} }

View File

@@ -73,7 +73,7 @@ define(['./_Symbol', './_Uint8Array', './eq', './_equalArrays', './_mapToArray',
case regexpTag: case regexpTag:
case stringTag: case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects, // 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. // for more details.
return object == (other + ''); return object == (other + '');

View File

@@ -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. */ /** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined; var undefined;
@@ -6,6 +6,12 @@ define(['./_baseHas', './keys'], function(baseHas, keys) {
/** Used to compose bitmasks for comparison styles. */ /** Used to compose bitmasks for comparison styles. */
var PARTIAL_COMPARE_FLAG = 2; 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 * A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons. * partial deep comparisons.
@@ -33,7 +39,7 @@ define(['./_baseHas', './keys'], function(baseHas, keys) {
var index = objLength; var index = objLength;
while (index--) { while (index--) {
var key = objProps[index]; var key = objProps[index];
if (!(isPartial ? key in other : baseHas(other, key))) { if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
return false; return false;
} }
} }
@@ -80,6 +86,7 @@ define(['./_baseHas', './keys'], function(baseHas, keys) {
} }
} }
stack['delete'](object); stack['delete'](object);
stack['delete'](other);
return result; return result;
} }

View File

@@ -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;
});

View File

@@ -1,16 +1,7 @@
define(['./_overArg'], function(overArg) { define(['./_overArg'], function(overArg) {
/* Built-in method references for those with the same name as other `lodash` methods. */ /** Built-in value references. */
var nativeGetPrototype = Object.getPrototypeOf; var getPrototype = overArg(Object.getPrototypeOf, Object);
/**
* Gets the `[[Prototype]]` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {null|Object} Returns the `[[Prototype]]`.
*/
var getPrototype = overArg(nativeGetPrototype, Object);
return getPrototype; return getPrototype;
}); });

View File

@@ -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. */ /* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols; var nativeGetSymbols = Object.getOwnPropertySymbols;
@@ -11,7 +11,7 @@ define(['./_arrayPush', './_getPrototype', './_getSymbols'], function(arrayPush,
* @param {Object} object The object to query. * @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols. * @returns {Array} Returns the array of symbols.
*/ */
var getSymbolsIn = !nativeGetSymbols ? getSymbols : function(object) { var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
var result = []; var result = [];
while (object) { while (object) {
arrayPush(result, getSymbols(object)); arrayPush(result, getSymbols(object));

View File

@@ -17,7 +17,7 @@ define(['./_DataView', './_Map', './_Promise', './_Set', './_WeakMap', './_baseG
/** /**
* Used to resolve the * 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -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;
});

View File

@@ -15,7 +15,7 @@ define(['./_Symbol', './isArguments', './isArray'], function(Symbol, isArguments
*/ */
function isFlattenable(value) { function isFlattenable(value) {
return isArray(value) || isArguments(value) || return isArray(value) || isArguments(value) ||
!!(spreadableSymbol && value && value[spreadableSymbol]) !!(spreadableSymbol && value && value[spreadableSymbol]);
} }
return isFlattenable; return isFlattenable;

7
_nativeKeys.js Normal file
View 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
View 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;
});

View File

@@ -1,10 +1,10 @@
define(['./_freeGlobal'], function(freeGlobal) { define(['./_freeGlobal'], function(freeGlobal) {
/** Detect free variable `exports`. */ /** Detect free variable `exports`. */
var freeExports = freeGlobal && typeof exports == 'object' && exports; var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */ /** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module; var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */ /** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports; var moduleExports = freeModule && freeModule.exports === freeExports;

View File

@@ -1,7 +1,7 @@
define([], function() { 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 * @private
* @param {Function} func The function to wrap. * @param {Function} func The function to wrap.

View File

@@ -1,7 +1,8 @@
define(['./memoize', './toString'], function(memoize, toString) { define(['./memoize', './toString'], function(memoize, toString) {
/** Used to match property names within property paths. */ /** Used to match property names within property paths. */
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g; var reLeadingDot = /^\./,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
/** Used to match backslashes in property paths. */ /** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g; var reEscapeChar = /\\(\\)?/g;
@@ -14,8 +15,13 @@ define(['./memoize', './toString'], function(memoize, toString) {
* @returns {Array} Returns the property path array. * @returns {Array} Returns the property path array.
*/ */
var stringToPath = memoize(function(string) { var stringToPath = memoize(function(string) {
string = toString(string);
var result = []; var result = [];
toString(string).replace(rePropName, function(match, number, quote, string) { if (reLeadingDot.test(string)) {
result.push('');
}
string.replace(rePropName, function(match, number, quote, string) {
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
}); });
return result; return result;

View File

@@ -1,13 +1,4 @@
define(['./_assignValue', './_copyObject', './_createAssigner', './isArrayLike', './_isPrototype', './keysIn'], function(assignValue, copyObject, createAssigner, isArrayLike, isPrototype, keysIn) { define(['./_copyObject', './_createAssigner', './keysIn'], function(copyObject, createAssigner, 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');
/** /**
* This method is like `_.assign` except that it iterates over own and * 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 } * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
*/ */
var assignIn = createAssigner(function(object, source) { var assignIn = createAssigner(function(object, source) {
if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) { copyObject(source, keysIn(source), object);
copyObject(source, keysIn(source), object);
return;
}
for (var key in source) {
assignValue(object, key, source[key]);
}
}); });
return assignIn; return assignIn;

View File

@@ -5,6 +5,9 @@ define(['./_baseClone', './_baseConforms'], function(baseClone, baseConforms) {
* the corresponding property values of a given object, returning `true` if * the corresponding property values of a given object, returning `true` if
* all predicates return truthy, else `false`. * all predicates return truthy, else `false`.
* *
* **Note:** The created function is equivalent to `_.conformsTo` with
* `source` partially applied.
*
* @static * @static
* @memberOf _ * @memberOf _
* @since 4.0.0 * @since 4.0.0

View File

@@ -1,9 +1,11 @@
define(['./_baseConformsTo', './keys'], function(baseConformsTo, keys) { define(['./_baseConformsTo', './keys'], function(baseConformsTo, keys) {
/** /**
* Checks if `object` conforms to `source` by invoking the predicate properties * Checks if `object` conforms to `source` by invoking the predicate
* of `source` with the corresponding property values of `object`. This method * properties of `source` with the corresponding property values of `object`.
* is equivalent to a `_.conforms` function when `source` is partially applied. *
* **Note:** This method is equivalent to `_.conforms` when `source` is
* partially applied.
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -15,14 +15,18 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
* milliseconds have elapsed since the last time the debounced function was * milliseconds have elapsed since the last time the debounced function was
* invoked. The debounced function comes with a `cancel` method to cancel * invoked. The debounced function comes with a `cancel` method to cancel
* delayed `func` invocations and a `flush` method to immediately invoke them. * delayed `func` invocations and a `flush` method to immediately invoke them.
* Provide an options object to indicate whether `func` should be invoked on * Provide `options` to indicate whether `func` should be invoked on the
* the leading and/or trailing edge of the `wait` timeout. The `func` is invoked * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
* with the last arguments provided to the debounced function. Subsequent calls * with the last arguments provided to the debounced function. Subsequent
* to the debounced function return the result of the last `func` invocation. * calls to the debounced function return the result of the last `func`
* invocation.
* *
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked * **Note:** If `leading` and `trailing` options are `true`, `func` is
* on the trailing edge of the timeout only if the debounced function is * invoked on the trailing edge of the timeout only if the debounced function
* invoked more than once during the `wait` timeout. * is invoked more than once during the `wait` timeout.
*
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
* *
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
* for details over the differences between `_.debounce` and `_.throttle`. * for details over the differences between `_.debounce` and `_.throttle`.

View File

@@ -2,7 +2,7 @@ define(['./_baseDifference', './_baseFlatten', './_baseRest', './isArrayLikeObje
/** /**
* Creates an array of `array` values not included in the other given arrays * 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 * for equality comparisons. The order of result values is determined by the
* order they occur in the first array. * order they occur in the first array.
* *

2
eq.js
View File

@@ -2,7 +2,7 @@ define([], function() {
/** /**
* Performs a * 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. * comparison between two values to determine if they are equivalent.
* *
* @static * @static

View File

@@ -2,7 +2,7 @@ define(['./toString'], function(toString) {
/** /**
* Used to match `RegExp` * 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, var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
reHasRegExpChar = RegExp(reRegExpChar.source); reHasRegExpChar = RegExp(reRegExpChar.source);

View File

@@ -8,6 +8,11 @@ define(['./_arrayEvery', './_baseEvery', './_baseIteratee', './isArray', './_isI
* Iteration is stopped once `predicate` returns falsey. The predicate is * Iteration is stopped once `predicate` returns falsey. The predicate is
* invoked with three arguments: (value, index|key, collection). * 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 * @static
* @memberOf _ * @memberOf _
* @since 0.1.0 * @since 0.1.0

View File

@@ -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. */ /** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined; var undefined;
@@ -42,12 +42,12 @@ define(['./_baseInRange', './toNumber'], function(baseInRange, toNumber) {
* // => true * // => true
*/ */
function inRange(number, start, end) { function inRange(number, start, end) {
start = toNumber(start) || 0; start = toFinite(start);
if (end === undefined) { if (end === undefined) {
end = start; end = start;
start = 0; start = 0;
} else { } else {
end = toNumber(end) || 0; end = toFinite(end);
} }
number = toNumber(number); number = toNumber(number);
return baseInRange(number, start, end); return baseInRange(number, start, end);

View File

@@ -6,7 +6,7 @@ define(['./_baseIndexOf', './isArrayLike', './isString', './toInteger', './value
/** /**
* Checks if `value` is in `collection`. If `collection` is a string, it's * Checks if `value` is in `collection`. If `collection` is a string, it's
* checked for a substring of `value`, otherwise * 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 * is used for equality comparisons. If `fromIndex` is negative, it's used as
* the offset from the end of `collection`. * the offset from the end of `collection`.
* *

View File

@@ -5,7 +5,7 @@ define(['./_baseIndexOf', './toInteger'], function(baseIndexOf, toInteger) {
/** /**
* Gets the index at which the first occurrence of `value` is found in `array` * 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 * for equality comparisons. If `fromIndex` is negative, it's used as the
* offset from the end of `array`. * offset from the end of `array`.
* *

View File

@@ -1,4 +1,4 @@
define(['./dropRight'], function(dropRight) { define(['./_baseSlice'], function(baseSlice) {
/** /**
* Gets all but the last element of `array`. * Gets all but the last element of `array`.
@@ -15,7 +15,8 @@ define(['./dropRight'], function(dropRight) {
* // => [1, 2] * // => [1, 2]
*/ */
function initial(array) { function initial(array) {
return dropRight(array, 1); var length = array ? array.length : 0;
return length ? baseSlice(array, 0, -1) : [];
} }
return initial; return initial;

View File

@@ -2,7 +2,7 @@ define(['./_arrayMap', './_baseIntersection', './_baseRest', './_castArrayLikeOb
/** /**
* Creates an array of unique values that are included in all given arrays * 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 * for equality comparisons. The order of result values is determined by the
* order they occur in the first array. * order they occur in the first array.
* *

View File

@@ -11,7 +11,7 @@ define(['./isArrayLikeObject'], function(isArrayLikeObject) {
/** /**
* Used to resolve the * 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -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 * 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 * // => false
*/ */
function isArrayLike(value) { function isArrayLike(value) {
return value != null && isLength(getLength(value)) && !isFunction(value); return value != null && isLength(value.length) && !isFunction(value);
} }
return isArrayLike; return isArrayLike;

View File

@@ -8,7 +8,7 @@ define(['./isObjectLike'], function(isObjectLike) {
/** /**
* Used to resolve the * 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -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. */ /** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined; var undefined;
/** Detect free variable `exports`. */ /** Detect free variable `exports`. */
var freeExports = freeGlobal && typeof exports == 'object' && exports; var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */ /** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module; var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */ /** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports; var moduleExports = freeModule && freeModule.exports === freeExports;

View File

@@ -8,8 +8,7 @@ define(['./isObjectLike', './isPlainObject'], function(isObjectLike, isPlainObje
* @since 0.1.0 * @since 0.1.0
* @category Lang * @category Lang
* @param {*} value The value to check. * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a DOM element, * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
* else `false`.
* @example * @example
* *
* _.isElement(document.body); * _.isElement(document.body);

View File

@@ -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. */ /** `Object#toString` result references. */
var mapTag = '[object Map]', var mapTag = '[object Map]',
@@ -61,12 +61,14 @@ define(['./_getTag', './isArguments', './isArray', './isArrayLike', './isBuffer'
return !value.size; return !value.size;
} }
} }
var isProto = isPrototype(value);
for (var key in value) { for (var key in value) {
if (hasOwnProperty.call(value, key)) { if (hasOwnProperty.call(value, key) &&
!(isProto && key == 'constructor')) {
return false; return false;
} }
} }
return !(nonEnumShadows && keys(value).length); return !(nonEnumShadows && nativeKeys(value).length);
} }
return isEmpty; return isEmpty;

View File

@@ -16,8 +16,7 @@ define(['./_baseIsEqual'], function(baseIsEqual) {
* @category Lang * @category Lang
* @param {*} value The value to compare. * @param {*} value The value to compare.
* @param {*} other The other value to compare. * @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* else `false`.
* @example * @example
* *
* var object = { 'a': 1 }; * var object = { 'a': 1 };

View File

@@ -16,8 +16,7 @@ define(['./_baseIsEqual'], function(baseIsEqual) {
* @param {*} value The value to compare. * @param {*} value The value to compare.
* @param {*} other The other value to compare. * @param {*} other The other value to compare.
* @param {Function} [customizer] The function to customize comparisons. * @param {Function} [customizer] The function to customize comparisons.
* @returns {boolean} Returns `true` if the values are equivalent, * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* else `false`.
* @example * @example
* *
* function isGreeting(value) { * function isGreeting(value) {

View File

@@ -8,7 +8,7 @@ define(['./isObjectLike'], function(isObjectLike) {
/** /**
* Used to resolve the * 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;
@@ -22,8 +22,7 @@ define(['./isObjectLike'], function(isObjectLike) {
* @since 3.0.0 * @since 3.0.0
* @category Lang * @category Lang
* @param {*} value The value to check. * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an error object, * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
* else `false`.
* @example * @example
* *
* _.isError(new Error); * _.isError(new Error);

View File

@@ -14,8 +14,7 @@ define(['./_root'], function(root) {
* @since 0.1.0 * @since 0.1.0
* @category Lang * @category Lang
* @param {*} value The value to check. * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a finite number, * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
* else `false`.
* @example * @example
* *
* _.isFinite(3); * _.isFinite(3);

View File

@@ -9,7 +9,7 @@ define(['./isObject'], function(isObject) {
/** /**
* Used to resolve the * 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -6,16 +6,15 @@ define([], function() {
/** /**
* Checks if `value` is a valid array-like length. * Checks if `value` is a valid array-like length.
* *
* **Note:** This function is loosely based on * **Note:** This method is loosely 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 * @static
* @memberOf _ * @memberOf _
* @since 4.0.0 * @since 4.0.0
* @category Lang * @category Lang
* @param {*} value The value to check. * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* else `false`.
* @example * @example
* *
* _.isLength(3); * _.isLength(3);

View File

@@ -2,10 +2,14 @@ define(['./_baseIsMatch', './_getMatchData'], function(baseIsMatch, getMatchData
/** /**
* Performs a partial deep comparison between `object` and `source` to * Performs a partial deep comparison between `object` and `source` to
* determine if `object` contains equivalent property values. This method is * determine if `object` contains equivalent property values.
* equivalent to a `_.matches` function when `source` is partially applied.
* *
* **Note:** This method supports comparing the same values as `_.isEqual`. * **Note:** This method 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 * @static
* @memberOf _ * @memberOf _

View File

@@ -8,7 +8,7 @@ define(['./isObjectLike'], function(isObjectLike) {
/** /**
* Used to resolve the * 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -2,7 +2,7 @@ define([], function() {
/** /**
* Checks if `value` is the * 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('')`) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
* *
* @static * @static

View File

@@ -17,7 +17,7 @@ define(['./_getPrototype', './_isHostObject', './isObjectLike'], function(getPro
/** /**
* Used to resolve the * 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;
@@ -31,8 +31,7 @@ define(['./_getPrototype', './_isHostObject', './isObjectLike'], function(getPro
* @since 0.8.0 * @since 0.8.0
* @category Lang * @category Lang
* @param {*} value The value to check. * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* else `false`.
* @example * @example
* *
* function Foo() { * function Foo() {

View File

@@ -15,8 +15,7 @@ define(['./isInteger'], function(isInteger) {
* @since 4.0.0 * @since 4.0.0
* @category Lang * @category Lang
* @param {*} value The value to check. * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a safe integer, * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
* else `false`.
* @example * @example
* *
* _.isSafeInteger(3); * _.isSafeInteger(3);

View File

@@ -8,7 +8,7 @@ define(['./isArray', './isObjectLike'], function(isArray, isObjectLike) {
/** /**
* Used to resolve the * 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -8,7 +8,7 @@ define(['./isObjectLike'], function(isObjectLike) {
/** /**
* Used to resolve the * 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -8,7 +8,7 @@ define(['./isObjectLike'], function(isObjectLike) {
/** /**
* Used to resolve the * 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

22
keys.js
View File

@@ -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`. * Creates an array of the own enumerable property names of `object`.
* *
* **Note:** Non-object values are coerced to objects. See the * **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. * for more details.
* *
* @static * @static
@@ -29,23 +29,7 @@ define(['./_baseHas', './_baseKeys', './_indexKeys', './isArrayLike', './_isInde
* // => ['0', '1'] * // => ['0', '1']
*/ */
function keys(object) { function keys(object) {
var isProto = isPrototype(object); return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(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 keys; return keys;

View File

@@ -1,10 +1,4 @@
define(['./_baseKeysIn', './_indexKeys', './_isIndex', './_isPrototype'], function(baseKeysIn, indexKeys, isIndex, isPrototype) { define(['./_arrayLikeKeys', './_baseKeysIn', './isArrayLike'], function(arrayLikeKeys, baseKeysIn, isArrayLike) {
/** 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 own and inherited enumerable property names of `object`. * 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) * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
*/ */
function keysIn(object) { function keysIn(object) {
var index = -1, return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
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 keysIn; return keysIn;

455
main.js
View File

@@ -13,7 +13,7 @@
var undefined; var undefined;
/** Used as the semantic version number. */ /** 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. */ /** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200; var LARGE_ARRAY_SIZE = 200;
@@ -130,11 +130,12 @@
/** Used to match property names within property paths. */ /** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/, reIsPlainProp = /^\w*$/,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g; reLeadingDot = /^\./,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
/** /**
* Used to match `RegExp` * 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, var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
reHasRegExpChar = RegExp(reRegExpChar.source); reHasRegExpChar = RegExp(reRegExpChar.source);
@@ -157,7 +158,7 @@
/** /**
* Used to match * 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; var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
@@ -266,9 +267,9 @@
var contextProps = [ var contextProps = [
'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
'Promise', 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', '_', 'clearTimeout',
'_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' 'isFinite', 'parseInt', 'setTimeout'
]; ];
/** Used to make template sourceURLs easier to identify. */ /** Used to make template sourceURLs easier to identify. */
@@ -371,10 +372,10 @@
var root = freeGlobal || freeSelf || Function('return this')(); var root = freeGlobal || freeSelf || Function('return this')();
/** Detect free variable `exports`. */ /** Detect free variable `exports`. */
var freeExports = freeGlobal && typeof exports == 'object' && exports; var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */ /** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module; var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */ /** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports; var moduleExports = freeModule && freeModule.exports === freeExports;
@@ -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 * @private
* @param {Function} func The function to wrap. * @param {Function} func The function to wrap.
@@ -1282,7 +1283,6 @@
/** Built-in constructor references. */ /** Built-in constructor references. */
var Array = context.Array, var Array = context.Array,
Date = context.Date,
Error = context.Error, Error = context.Error,
Math = context.Math, Math = context.Math,
RegExp = context.RegExp, RegExp = context.RegExp,
@@ -1316,7 +1316,7 @@
/** /**
* Used to resolve the * 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;
@@ -1332,29 +1332,28 @@
/** Built-in value references. */ /** Built-in value references. */
var Buffer = moduleExports ? context.Buffer : undefined, var Buffer = moduleExports ? context.Buffer : undefined,
Reflect = context.Reflect,
Symbol = context.Symbol, Symbol = context.Symbol,
Uint8Array = context.Uint8Array, Uint8Array = context.Uint8Array,
enumerate = Reflect ? Reflect.enumerate : undefined, getPrototype = overArg(Object.getPrototypeOf, Object),
iteratorSymbol = Symbol ? Symbol.iterator : undefined, iteratorSymbol = Symbol ? Symbol.iterator : undefined,
objectCreate = context.Object.create, objectCreate = context.Object.create,
propertyIsEnumerable = objectProto.propertyIsEnumerable, propertyIsEnumerable = objectProto.propertyIsEnumerable,
splice = arrayProto.splice, splice = arrayProto.splice,
spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined; spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
/** Built-in method references that are mockable. */ /** Mocked built-ins. */
var clearTimeout = function(id) { return context.clearTimeout.call(root, id); }, var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
setTimeout = function(func, wait) { return context.setTimeout.call(root, func, wait); }; 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. */ /* Built-in method references for those with the same name as other `lodash` methods. */
var nativeCeil = Math.ceil, var nativeCeil = Math.ceil,
nativeFloor = Math.floor, nativeFloor = Math.floor,
nativeGetPrototype = Object.getPrototypeOf,
nativeGetSymbols = Object.getOwnPropertySymbols, nativeGetSymbols = Object.getOwnPropertySymbols,
nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
nativeIsFinite = context.isFinite, nativeIsFinite = context.isFinite,
nativeJoin = arrayProto.join, nativeJoin = arrayProto.join,
nativeKeys = Object.keys, nativeKeys = overArg(Object.keys, Object),
nativeMax = Math.max, nativeMax = Math.max,
nativeMin = Math.min, nativeMin = Math.min,
nativeParseInt = context.parseInt, 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. * 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 * 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. * for equality comparisons.
* *
* @private * @private
@@ -2415,9 +2439,6 @@
// Recursively populate clone (susceptible to call stack limits). // Recursively populate clone (susceptible to call stack limits).
assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack)); assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
}); });
if (!isFull) {
stack['delete'](value);
}
return result; return result;
} }
@@ -2448,14 +2469,13 @@
if (object == null) { if (object == null) {
return !length; return !length;
} }
var index = length; object = Object(object);
while (index--) { while (length--) {
var key = props[index], var key = props[length],
predicate = source[key], predicate = source[key],
value = object[key]; value = object[key];
if ((value === undefined && if ((value === undefined && !(key in object)) || !predicate(value)) {
!(key in Object(object))) || !predicate(value)) {
return false; return false;
} }
} }
@@ -2482,7 +2502,7 @@
* @param {Function} func The function to delay. * @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay invocation. * @param {number} wait The number of milliseconds to delay invocation.
* @param {Array} args The arguments to provide to `func`. * @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) { function baseDelay(func, wait, args) {
if (typeof func != 'function') { if (typeof func != 'function') {
@@ -2827,12 +2847,7 @@
* @returns {boolean} Returns `true` if `key` exists, else `false`. * @returns {boolean} Returns `true` if `key` exists, else `false`.
*/ */
function baseHas(object, key) { function baseHas(object, key) {
// Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, return object != null && hasOwnProperty.call(object, key);
// 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));
} }
/** /**
@@ -3206,40 +3221,47 @@
} }
/** /**
* The base implementation of `_.keys` which doesn't skip the constructor * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
* property of prototypes or treat sparse arrays as dense.
* *
* @private * @private
* @param {Object} object The object to query. * @param {Object} object The object to query.
* @returns {Array} Returns the array of property names. * @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 * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
* property of prototypes or treat sparse arrays as dense.
* *
* @private * @private
* @param {Object} object The object to query. * @param {Object} object The object to query.
* @returns {Array} Returns the array of property names. * @returns {Array} Returns the array of property names.
*/ */
function baseKeysIn(object) { 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) { for (var key in object) {
result.push(key); if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
}
} }
return result; 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. * The base implementation of `_.lt` which doesn't coerce arguments.
* *
@@ -3324,7 +3346,7 @@
return; return;
} }
if (!(isArray(source) || isTypedArray(source))) { if (!(isArray(source) || isTypedArray(source))) {
var props = keysIn(source); var props = baseKeysIn(source);
} }
arrayEach(props || source, function(srcValue, key) { arrayEach(props || source, function(srcValue, key) {
if (props) { if (props) {
@@ -3691,6 +3713,9 @@
* @returns {Object} Returns `object`. * @returns {Object} Returns `object`.
*/ */
function baseSet(object, path, value, customizer) { function baseSet(object, path, value, customizer) {
if (!isObject(object)) {
return object;
}
path = isKey(path, object) ? [path] : castPath(path); path = isKey(path, object) ? [path] : castPath(path);
var index = -1, var index = -1,
@@ -3699,20 +3724,19 @@
nested = object; nested = object;
while (nested != null && ++index < length) { while (nested != null && ++index < length) {
var key = toKey(path[index]); var key = toKey(path[index]),
if (isObject(nested)) { newValue = value;
var newValue = value;
if (index != lastIndex) { if (index != lastIndex) {
var objValue = nested[key]; var objValue = nested[key];
newValue = customizer ? customizer(objValue, key, nested) : undefined; newValue = customizer ? customizer(objValue, key, nested) : undefined;
if (newValue === undefined) { if (newValue === undefined) {
newValue = objValue == null newValue = isObject(objValue)
? (isIndex(path[index + 1]) ? [] : {}) ? objValue
: objValue; : (isIndex(path[index + 1]) ? [] : {});
}
} }
assignValue(nested, key, newValue);
} }
assignValue(nested, key, newValue);
nested = nested[key]; nested = nested[key];
} }
return object; return object;
@@ -4005,7 +4029,7 @@
object = parent(object, path); object = parent(object, path);
var key = toKey(last(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); 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`. * Creates a clone of `buffer`.
* *
@@ -4653,7 +4687,7 @@
function createCtor(Ctor) { function createCtor(Ctor) {
return function() { return function() {
// Use a `switch` statement to work with class constructors. See // 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. // for more details.
var args = arguments; var args = arguments;
switch (args.length) { switch (args.length) {
@@ -5009,15 +5043,14 @@
end = step = undefined; end = step = undefined;
} }
// Ensure the sign of `-0` is preserved. // Ensure the sign of `-0` is preserved.
start = toNumber(start); start = toFinite(start);
start = start === start ? start : 0;
if (end === undefined) { if (end === undefined) {
end = start; end = start;
start = 0; start = 0;
} else { } else {
end = toNumber(end) || 0; end = toFinite(end);
} }
step = step === undefined ? (start < end ? 1 : -1) : (toNumber(step) || 0); step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
return baseRange(start, end, step, fromRight); return baseRange(start, end, step, fromRight);
}; };
} }
@@ -5290,6 +5323,7 @@
} }
} }
stack['delete'](array); stack['delete'](array);
stack['delete'](other);
return result; return result;
} }
@@ -5341,7 +5375,7 @@
case regexpTag: case regexpTag:
case stringTag: case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects, // 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. // for more details.
return object == (other + ''); return object == (other + '');
@@ -5403,7 +5437,7 @@
var index = objLength; var index = objLength;
while (index--) { while (index--) {
var key = objProps[index]; var key = objProps[index];
if (!(isPartial ? key in other : baseHas(other, key))) { if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
return false; return false;
} }
} }
@@ -5450,6 +5484,7 @@
} }
} }
stack['delete'](object); stack['delete'](object);
stack['delete'](other);
return result; return result;
} }
@@ -5538,19 +5573,6 @@
return arguments.length ? result(arguments[0], arguments[1]) : result; 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`. * Gets the data for `map`.
* *
@@ -5599,15 +5621,6 @@
return baseIsNative(value) ? value : undefined; 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`. * Creates an array of the own enumerable symbol properties of `object`.
* *
@@ -5625,7 +5638,7 @@
* @param {Object} object The object to query. * @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols. * @returns {Array} Returns the array of symbols.
*/ */
var getSymbolsIn = !nativeGetSymbols ? getSymbols : function(object) { var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
var result = []; var result = [];
while (object) { while (object) {
arrayPush(result, getSymbols(object)); arrayPush(result, getSymbols(object));
@@ -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. * Inserts wrapper `details` in a comment at the top of the `source` body.
* *
@@ -5863,7 +5859,7 @@
*/ */
function isFlattenable(value) { function isFlattenable(value) {
return isArray(value) || isArguments(value) || return isArray(value) || isArguments(value) ||
!!(spreadableSymbol && value && value[spreadableSymbol]) !!(spreadableSymbol && value && value[spreadableSymbol]);
} }
/** /**
@@ -6121,6 +6117,25 @@
return objValue; 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`. * 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` * 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. * with wrapper details in a comment at the top of the source body.
@@ -6216,8 +6243,13 @@
* @returns {Array} Returns the property path array. * @returns {Array} Returns the property path array.
*/ */
var stringToPath = memoize(function(string) { var stringToPath = memoize(function(string) {
string = toString(string);
var result = []; var result = [];
toString(string).replace(rePropName, function(match, number, quote, string) { if (reLeadingDot.test(string)) {
result.push('');
}
string.replace(rePropName, function(match, number, quote, string) {
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
}); });
return result; return result;
@@ -6404,7 +6436,7 @@
/** /**
* Creates an array of `array` values not included in the other given arrays * 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 * for equality comparisons. The order of result values is determined by the
* order they occur in the first array. * 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` * 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 * for equality comparisons. If `fromIndex` is negative, it's used as the
* offset from the end of `array`. * offset from the end of `array`.
* *
@@ -6955,12 +6987,13 @@
* // => [1, 2] * // => [1, 2]
*/ */
function initial(array) { 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 * 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 * for equality comparisons. The order of result values is determined by the
* order they occur in the first array. * order they occur in the first array.
* *
@@ -7164,7 +7197,7 @@
/** /**
* Removes all given values from `array` using * 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. * for equality comparisons.
* *
* **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
@@ -7633,7 +7666,8 @@
* // => [2, 3] * // => [2, 3]
*/ */
function tail(array) { 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 * 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. * for equality comparisons.
* *
* @static * @static
@@ -7871,7 +7905,7 @@
/** /**
* Creates a duplicate-free version of an array, using * 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 * for equality comparisons, in which only the first occurrence of each
* element is kept. * element is kept.
* *
@@ -8016,7 +8050,7 @@
/** /**
* Creates an array excluding all given values using * 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. * for equality comparisons.
* *
* **Note:** Unlike `_.pull`, this method returns a new array. * **Note:** Unlike `_.pull`, this method returns a new array.
@@ -8587,6 +8621,11 @@
* Iteration is stopped once `predicate` returns falsey. The predicate is * Iteration is stopped once `predicate` returns falsey. The predicate is
* invoked with three arguments: (value, index|key, collection). * 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 * @static
* @memberOf _ * @memberOf _
* @since 0.1.0 * @since 0.1.0
@@ -8904,7 +8943,7 @@
/** /**
* Checks if `value` is in `collection`. If `collection` is a string, it's * Checks if `value` is in `collection`. If `collection` is a string, it's
* checked for a substring of `value`, otherwise * 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 * is used for equality comparisons. If `fromIndex` is negative, it's used as
* the offset from the end of `collection`. * the offset from the end of `collection`.
* *
@@ -9372,7 +9411,7 @@
return collection.size; return collection.size;
} }
} }
return keys(collection).length; return baseKeys(collection).length;
} }
/** /**
@@ -9484,9 +9523,9 @@
* }, _.now()); * }, _.now());
* // => Logs the number of milliseconds it took for the deferred invocation. * // => Logs the number of milliseconds it took for the deferred invocation.
*/ */
function now() { var now = ctxNow || function() {
return Date.now(); return root.Date.now();
} };
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
@@ -9779,14 +9818,18 @@
* milliseconds have elapsed since the last time the debounced function was * milliseconds have elapsed since the last time the debounced function was
* invoked. The debounced function comes with a `cancel` method to cancel * invoked. The debounced function comes with a `cancel` method to cancel
* delayed `func` invocations and a `flush` method to immediately invoke them. * delayed `func` invocations and a `flush` method to immediately invoke them.
* Provide an options object to indicate whether `func` should be invoked on * Provide `options` to indicate whether `func` should be invoked on the
* the leading and/or trailing edge of the `wait` timeout. The `func` is invoked * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
* with the last arguments provided to the debounced function. Subsequent calls * with the last arguments provided to the debounced function. Subsequent
* to the debounced function return the result of the last `func` invocation. * calls to the debounced function return the result of the last `func`
* invocation.
* *
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked * **Note:** If `leading` and `trailing` options are `true`, `func` is
* on the trailing edge of the timeout only if the debounced function is * invoked on the trailing edge of the timeout only if the debounced function
* invoked more than once during the `wait` timeout. * is invoked more than once during the `wait` timeout.
*
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
* *
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
* for details over the differences between `_.debounce` and `_.throttle`. * for details over the differences between `_.debounce` and `_.throttle`.
@@ -10023,7 +10066,7 @@
* **Note:** The cache is exposed as the `cache` property on the memoized * **Note:** The cache is exposed as the `cache` property on the memoized
* function. Its creation may be customized by replacing the `_.memoize.Cache` * function. Its creation may be customized by replacing the `_.memoize.Cache`
* constructor with one whose instances implement the * 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`. * method interface of `delete`, `get`, `has`, and `set`.
* *
* @static * @static
@@ -10323,7 +10366,7 @@
/** /**
* Creates a function that invokes `func` with the `this` binding of the * Creates a function that invokes `func` with the `this` binding of the
* create function and an array of arguments much like * 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 * **Note:** This method is based on the
* [spread operator](https://mdn.io/spread_operator). * [spread operator](https://mdn.io/spread_operator).
@@ -10374,8 +10417,8 @@
* Creates a throttled function that only invokes `func` at most once per * Creates a throttled function that only invokes `func` at most once per
* every `wait` milliseconds. The throttled function comes with a `cancel` * every `wait` milliseconds. The throttled function comes with a `cancel`
* method to cancel delayed `func` invocations and a `flush` method to * method to cancel delayed `func` invocations and a `flush` method to
* immediately invoke them. Provide an options object to indicate whether * immediately invoke them. Provide `options` to indicate whether `func`
* `func` should be invoked on the leading and/or trailing edge of the `wait` * should be invoked on the leading and/or trailing edge of the `wait`
* timeout. The `func` is invoked with the last arguments provided to the * timeout. The `func` is invoked with the last arguments provided to the
* throttled function. Subsequent calls to the throttled function return the * throttled function. Subsequent calls to the throttled function return the
* result of the last `func` invocation. * result of the last `func` invocation.
@@ -10384,6 +10427,9 @@
* invoked on the trailing edge of the timeout only if the throttled function * invoked on the trailing edge of the timeout only if the throttled function
* is invoked more than once during the `wait` timeout. * is invoked more than once during the `wait` timeout.
* *
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
*
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
* for details over the differences between `_.throttle` and `_.debounce`. * for details over the differences between `_.throttle` and `_.debounce`.
* *
@@ -10638,9 +10684,11 @@
} }
/** /**
* Checks if `object` conforms to `source` by invoking the predicate properties * Checks if `object` conforms to `source` by invoking the predicate
* of `source` with the corresponding property values of `object`. This method * properties of `source` with the corresponding property values of `object`.
* is equivalent to a `_.conforms` function when `source` is partially applied. *
* **Note:** This method is equivalent to `_.conforms` when `source` is
* partially applied.
* *
* @static * @static
* @memberOf _ * @memberOf _
@@ -10665,7 +10713,7 @@
/** /**
* Performs a * 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. * comparison between two values to determine if they are equivalent.
* *
* @static * @static
@@ -10845,7 +10893,7 @@
* // => false * // => false
*/ */
function isArrayLike(value) { 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 * @since 0.1.0
* @category Lang * @category Lang
* @param {*} value The value to check. * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a DOM element, * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
* else `false`.
* @example * @example
* *
* _.isElement(document.body); * _.isElement(document.body);
@@ -11004,12 +11051,14 @@
return !value.size; return !value.size;
} }
} }
var isProto = isPrototype(value);
for (var key in value) { for (var key in value) {
if (hasOwnProperty.call(value, key)) { if (hasOwnProperty.call(value, key) &&
!(isProto && key == 'constructor')) {
return false; return false;
} }
} }
return !(nonEnumShadows && keys(value).length); return !(nonEnumShadows && nativeKeys(value).length);
} }
/** /**
@@ -11028,8 +11077,7 @@
* @category Lang * @category Lang
* @param {*} value The value to compare. * @param {*} value The value to compare.
* @param {*} other The other value to compare. * @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* else `false`.
* @example * @example
* *
* var object = { 'a': 1 }; * var object = { 'a': 1 };
@@ -11058,8 +11106,7 @@
* @param {*} value The value to compare. * @param {*} value The value to compare.
* @param {*} other The other value to compare. * @param {*} other The other value to compare.
* @param {Function} [customizer] The function to customize comparisons. * @param {Function} [customizer] The function to customize comparisons.
* @returns {boolean} Returns `true` if the values are equivalent, * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* else `false`.
* @example * @example
* *
* function isGreeting(value) { * function isGreeting(value) {
@@ -11093,8 +11140,7 @@
* @since 3.0.0 * @since 3.0.0
* @category Lang * @category Lang
* @param {*} value The value to check. * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an error object, * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
* else `false`.
* @example * @example
* *
* _.isError(new Error); * _.isError(new Error);
@@ -11122,8 +11168,7 @@
* @since 0.1.0 * @since 0.1.0
* @category Lang * @category Lang
* @param {*} value The value to check. * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a finite number, * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
* else `false`.
* @example * @example
* *
* _.isFinite(3); * _.isFinite(3);
@@ -11200,16 +11245,15 @@
/** /**
* Checks if `value` is a valid array-like length. * Checks if `value` is a valid array-like length.
* *
* **Note:** This function is loosely based on * **Note:** This method is loosely 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 * @static
* @memberOf _ * @memberOf _
* @since 4.0.0 * @since 4.0.0
* @category Lang * @category Lang
* @param {*} value The value to check. * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* else `false`.
* @example * @example
* *
* _.isLength(3); * _.isLength(3);
@@ -11231,7 +11275,7 @@
/** /**
* Checks if `value` is the * 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('')`) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
* *
* @static * @static
@@ -11308,10 +11352,14 @@
/** /**
* Performs a partial deep comparison between `object` and `source` to * Performs a partial deep comparison between `object` and `source` to
* determine if `object` contains equivalent property values. This method is * determine if `object` contains equivalent property values.
* equivalent to a `_.matches` function when `source` is partially applied.
* *
* **Note:** This method supports comparing the same values as `_.isEqual`. * **Note:** This method 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 * @static
* @memberOf _ * @memberOf _
@@ -11524,8 +11572,7 @@
* @since 0.8.0 * @since 0.8.0
* @category Lang * @category Lang
* @param {*} value The value to check. * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* else `false`.
* @example * @example
* *
* function Foo() { * function Foo() {
@@ -11589,8 +11636,7 @@
* @since 4.0.0 * @since 4.0.0
* @category Lang * @category Lang
* @param {*} value The value to check. * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a safe integer, * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
* else `false`.
* @example * @example
* *
* _.isSafeInteger(3); * _.isSafeInteger(3);
@@ -11884,7 +11930,7 @@
* Converts `value` to an integer. * Converts `value` to an integer.
* *
* **Note:** This method is loosely based on * **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 * @static
* @memberOf _ * @memberOf _
@@ -11918,7 +11964,7 @@
* array-like object. * array-like object.
* *
* **Note:** This method is based on * **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 * @static
* @memberOf _ * @memberOf _
@@ -12147,13 +12193,7 @@
* // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
*/ */
var assignIn = createAssigner(function(object, source) { var assignIn = createAssigner(function(object, source) {
if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) { copyObject(source, keysIn(source), object);
copyObject(source, keysIn(source), object);
return;
}
for (var key in source) {
assignValue(object, key, source[key]);
}
}); });
/** /**
@@ -12762,7 +12802,7 @@
* Creates an array of the own enumerable property names of `object`. * Creates an array of the own enumerable property names of `object`.
* *
* **Note:** Non-object values are coerced to objects. See the * **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. * for more details.
* *
* @static * @static
@@ -12787,23 +12827,7 @@
* // => ['0', '1'] * // => ['0', '1']
*/ */
function keys(object) { function keys(object) {
var isProto = isPrototype(object); return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(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;
} }
/** /**
@@ -12830,23 +12854,7 @@
* // => ['a', 'b', 'c'] (iteration order is not guaranteed) * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
*/ */
function keysIn(object) { function keysIn(object) {
var index = -1, return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
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;
} }
/** /**
@@ -13523,12 +13531,12 @@
* // => true * // => true
*/ */
function inRange(number, start, end) { function inRange(number, start, end) {
start = toNumber(start) || 0; start = toFinite(start);
if (end === undefined) { if (end === undefined) {
end = start; end = start;
start = 0; start = 0;
} else { } else {
end = toNumber(end) || 0; end = toFinite(end);
} }
number = toNumber(number); number = toNumber(number);
return baseInRange(number, start, end); return baseInRange(number, start, end);
@@ -13584,12 +13592,12 @@
upper = 1; upper = 1;
} }
else { else {
lower = toNumber(lower) || 0; lower = toFinite(lower);
if (upper === undefined) { if (upper === undefined) {
upper = lower; upper = lower;
lower = 0; lower = 0;
} else { } else {
upper = toNumber(upper) || 0; upper = toFinite(upper);
} }
} }
if (lower > upper) { if (lower > upper) {
@@ -14836,6 +14844,9 @@
* the corresponding property values of a given object, returning `true` if * the corresponding property values of a given object, returning `true` if
* all predicates return truthy, else `false`. * all predicates return truthy, else `false`.
* *
* **Note:** The created function is equivalent to `_.conformsTo` with
* `source` partially applied.
*
* @static * @static
* @memberOf _ * @memberOf _
* @since 4.0.0 * @since 4.0.0
@@ -15021,10 +15032,14 @@
/** /**
* Creates a function that performs a partial deep comparison between a given * Creates a function that performs a partial deep comparison between a given
* object and `source`, returning `true` if the given object has equivalent * object and `source`, returning `true` if the given object has equivalent
* property values, else `false`. The created function is equivalent to * property values, else `false`.
* `_.isMatch` with a `source` partially applied.
* *
* **Note:** This method supports comparing the same values as `_.isEqual`. * **Note:** The created function 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 * @static
* @memberOf _ * @memberOf _
@@ -15051,7 +15066,9 @@
* value at `path` of a given object to `srcValue`, returning `true` if the * value at `path` of a given object to `srcValue`, returning `true` if the
* object value is equivalent, else `false`. * 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 * @static
* @memberOf _ * @memberOf _

View File

@@ -3,10 +3,14 @@ define(['./_baseClone', './_baseMatches'], function(baseClone, baseMatches) {
/** /**
* Creates a function that performs a partial deep comparison between a given * Creates a function that performs a partial deep comparison between a given
* object and `source`, returning `true` if the given object has equivalent * object and `source`, returning `true` if the given object has equivalent
* property values, else `false`. The created function is equivalent to * property values, else `false`.
* `_.isMatch` with a `source` partially applied.
* *
* **Note:** This method supports comparing the same values as `_.isEqual`. * **Note:** The created function 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 * @static
* @memberOf _ * @memberOf _

View File

@@ -5,7 +5,9 @@ define(['./_baseClone', './_baseMatchesProperty'], function(baseClone, baseMatch
* value at `path` of a given object to `srcValue`, returning `true` if the * value at `path` of a given object to `srcValue`, returning `true` if the
* object value is equivalent, else `false`. * 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 * @static
* @memberOf _ * @memberOf _

View File

@@ -13,7 +13,7 @@ define(['./_MapCache'], function(MapCache) {
* **Note:** The cache is exposed as the `cache` property on the memoized * **Note:** The cache is exposed as the `cache` property on the memoized
* function. Its creation may be customized by replacing the `_.memoize.Cache` * function. Its creation may be customized by replacing the `_.memoize.Cache`
* constructor with one whose instances implement the * 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`. * method interface of `delete`, `get`, `has`, and `set`.
* *
* @static * @static

8
now.js
View File

@@ -1,4 +1,4 @@
define([], function() { define(['./_root'], function(root) {
/** /**
* Gets the timestamp of the number of milliseconds that have elapsed since * Gets the timestamp of the number of milliseconds that have elapsed since
@@ -16,9 +16,9 @@ define([], function() {
* }, _.now()); * }, _.now());
* // => Logs the number of milliseconds it took for the deferred invocation. * // => Logs the number of milliseconds it took for the deferred invocation.
*/ */
function now() { var now = function() {
return Date.now(); return root.Date.now();
} };
return now; return now;
}); });

View File

@@ -1,6 +1,6 @@
{ {
"name": "lodash-amd", "name": "lodash-amd",
"version": "4.14.0", "version": "4.14.2",
"description": "Lodash exported as AMD modules.", "description": "Lodash exported as AMD modules.",
"keywords": "amd, modules, stdlib, util", "keywords": "amd, modules, stdlib, util",
"homepage": "https://lodash.com/custom-builds", "homepage": "https://lodash.com/custom-builds",

View File

@@ -2,7 +2,7 @@ define(['./_baseRest', './pullAll'], function(baseRest, pullAll) {
/** /**
* Removes all given values from `array` using * 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. * for equality comparisons.
* *
* **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`

View File

@@ -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. */ /** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined; var undefined;
@@ -60,12 +60,12 @@ define(['./_baseRandom', './_isIterateeCall', './toNumber'], function(baseRandom
upper = 1; upper = 1;
} }
else { else {
lower = toNumber(lower) || 0; lower = toFinite(lower);
if (upper === undefined) { if (upper === undefined) {
upper = lower; upper = lower;
lower = 0; lower = 0;
} else { } else {
upper = toNumber(upper) || 0; upper = toFinite(upper);
} }
} }
if (lower > upper) { if (lower > upper) {

View File

@@ -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. */ /** `Object#toString` result references. */
var mapTag = '[object Map]', var mapTag = '[object Map]',
@@ -39,7 +39,7 @@ define(['./_getTag', './isArrayLike', './isObjectLike', './isString', './keys',
return collection.size; return collection.size;
} }
} }
return keys(collection).length; return baseKeys(collection).length;
} }
return size; return size;

View File

@@ -12,7 +12,7 @@ define(['./_apply', './_arrayPush', './_baseRest', './_castSlice', './toInteger'
/** /**
* Creates a function that invokes `func` with the `this` binding of the * Creates a function that invokes `func` with the `this` binding of the
* create function and an array of arguments much like * 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 * **Note:** This method is based on the
* [spread operator](https://mdn.io/spread_operator). * [spread operator](https://mdn.io/spread_operator).

View File

@@ -1,4 +1,4 @@
define(['./drop'], function(drop) { define(['./_baseSlice'], function(baseSlice) {
/** /**
* Gets all but the first element of `array`. * Gets all but the first element of `array`.
@@ -15,7 +15,8 @@ define(['./drop'], function(drop) {
* // => [2, 3] * // => [2, 3]
*/ */
function tail(array) { function tail(array) {
return drop(array, 1); var length = array ? array.length : 0;
return length ? baseSlice(array, 1, length) : [];
} }
return tail; return tail;

View File

@@ -10,7 +10,7 @@ define(['./_assignInDefaults', './assignInWith', './attempt', './_baseValues', '
/** /**
* Used to match * 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; var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;

View File

@@ -7,8 +7,8 @@ define(['./debounce', './isObject'], function(debounce, isObject) {
* Creates a throttled function that only invokes `func` at most once per * Creates a throttled function that only invokes `func` at most once per
* every `wait` milliseconds. The throttled function comes with a `cancel` * every `wait` milliseconds. The throttled function comes with a `cancel`
* method to cancel delayed `func` invocations and a `flush` method to * method to cancel delayed `func` invocations and a `flush` method to
* immediately invoke them. Provide an options object to indicate whether * immediately invoke them. Provide `options` to indicate whether `func`
* `func` should be invoked on the leading and/or trailing edge of the `wait` * should be invoked on the leading and/or trailing edge of the `wait`
* timeout. The `func` is invoked with the last arguments provided to the * timeout. The `func` is invoked with the last arguments provided to the
* throttled function. Subsequent calls to the throttled function return the * throttled function. Subsequent calls to the throttled function return the
* result of the last `func` invocation. * result of the last `func` invocation.
@@ -17,6 +17,9 @@ define(['./debounce', './isObject'], function(debounce, isObject) {
* invoked on the trailing edge of the timeout only if the throttled function * invoked on the trailing edge of the timeout only if the throttled function
* is invoked more than once during the `wait` timeout. * is invoked more than once during the `wait` timeout.
* *
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
*
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
* for details over the differences between `_.throttle` and `_.debounce`. * for details over the differences between `_.throttle` and `_.debounce`.
* *

View File

@@ -4,7 +4,7 @@ define(['./toFinite'], function(toFinite) {
* Converts `value` to an integer. * Converts `value` to an integer.
* *
* **Note:** This method is loosely based on * **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 * @static
* @memberOf _ * @memberOf _

View File

@@ -8,7 +8,7 @@ define(['./_baseClamp', './toInteger'], function(baseClamp, toInteger) {
* array-like object. * array-like object.
* *
* **Note:** This method is based on * **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 * @static
* @memberOf _ * @memberOf _

View File

@@ -2,7 +2,7 @@ define(['./_baseFlatten', './_baseRest', './_baseUniq', './isArrayLikeObject'],
/** /**
* Creates an array of unique values, in order, from all given arrays using * 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. * for equality comparisons.
* *
* @static * @static

View File

@@ -2,7 +2,7 @@ define(['./_baseUniq'], function(baseUniq) {
/** /**
* Creates a duplicate-free version of an array, using * 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 * for equality comparisons, in which only the first occurrence of each
* element is kept. * element is kept.
* *

View File

@@ -2,7 +2,7 @@ define(['./_baseDifference', './_baseRest', './isArrayLikeObject'], function(bas
/** /**
* Creates an array excluding all given values using * 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. * for equality comparisons.
* *
* **Note:** Unlike `_.pull`, this method returns a new array. * **Note:** Unlike `_.pull`, this method returns a new array.