mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
Compare commits
2 Commits
4.17.2-amd
...
4.17.4-amd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
955537d67f | ||
|
|
c7a7540e16 |
@@ -1,4 +1,4 @@
|
||||
# lodash-amd v4.17.2
|
||||
# lodash-amd v4.17.4
|
||||
|
||||
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.17.2-amd) for more details.
|
||||
See the [package source](https://github.com/lodash/lodash/tree/4.17.4-amd) for more details.
|
||||
|
||||
@@ -21,8 +21,7 @@ define(['./_Symbol', './_getRawTag', './_objectToString'], function(Symbol, getR
|
||||
if (value == null) {
|
||||
return value === undefined ? undefinedTag : nullTag;
|
||||
}
|
||||
value = Object(value);
|
||||
return (symToStringTag && symToStringTag in value)
|
||||
return (symToStringTag && symToStringTag in Object(value))
|
||||
? getRawTag(value)
|
||||
: objectToString(value);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_baseIsEqualDeep', './isObject', './isObjectLike'], function(baseIsEqualDeep, isObject, isObjectLike) {
|
||||
define(['./_baseIsEqualDeep', './isObjectLike'], function(baseIsEqualDeep, isObjectLike) {
|
||||
|
||||
/**
|
||||
* The base implementation of `_.isEqual` which supports partial comparisons
|
||||
@@ -18,7 +18,7 @@ define(['./_baseIsEqualDeep', './isObject', './isObjectLike'], function(baseIsEq
|
||||
if (value === other) {
|
||||
return true;
|
||||
}
|
||||
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
|
||||
if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
|
||||
return value !== value && other !== other;
|
||||
}
|
||||
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
||||
|
||||
@@ -31,17 +31,12 @@ define(['./_Stack', './_equalArrays', './_equalByTag', './_equalObjects', './_ge
|
||||
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
||||
var objIsArr = isArray(object),
|
||||
othIsArr = isArray(other),
|
||||
objTag = arrayTag,
|
||||
othTag = arrayTag;
|
||||
objTag = objIsArr ? arrayTag : getTag(object),
|
||||
othTag = othIsArr ? arrayTag : getTag(other);
|
||||
|
||||
objTag = objTag == argsTag ? objectTag : objTag;
|
||||
othTag = othTag == argsTag ? objectTag : othTag;
|
||||
|
||||
if (!objIsArr) {
|
||||
objTag = getTag(object);
|
||||
objTag = objTag == argsTag ? objectTag : objTag;
|
||||
}
|
||||
if (!othIsArr) {
|
||||
othTag = getTag(other);
|
||||
othTag = othTag == argsTag ? objectTag : othTag;
|
||||
}
|
||||
var objIsObj = objTag == objectTag,
|
||||
othIsObj = othTag == objectTag,
|
||||
isSameTag = objTag == othTag;
|
||||
|
||||
@@ -10,7 +10,6 @@ define(['./_basePickBy', './hasIn'], function(basePickBy, hasIn) {
|
||||
* @returns {Object} Returns the new object.
|
||||
*/
|
||||
function basePick(object, paths) {
|
||||
object = Object(object);
|
||||
return basePickBy(object, paths, function(value, path) {
|
||||
return hasIn(object, path);
|
||||
});
|
||||
|
||||
@@ -3,9 +3,6 @@ define(['./_LodashWrapper', './_flatRest', './_getData', './_getFuncName', './is
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/** Used as the size to enable large array optimizations. */
|
||||
var LARGE_ARRAY_SIZE = 200;
|
||||
|
||||
/** Error message constants. */
|
||||
var FUNC_ERROR_TEXT = 'Expected a function';
|
||||
|
||||
@@ -62,8 +59,7 @@ define(['./_LodashWrapper', './_flatRest', './_getData', './_getFuncName', './is
|
||||
var args = arguments,
|
||||
value = args[0];
|
||||
|
||||
if (wrapper && args.length == 1 &&
|
||||
isArray(value) && value.length >= LARGE_ARRAY_SIZE) {
|
||||
if (wrapper && args.length == 1 && isArray(value)) {
|
||||
return wrapper.plant(value).value();
|
||||
}
|
||||
var index = 0,
|
||||
|
||||
@@ -14,7 +14,7 @@ define(['./toInteger', './toNumber', './toString'], function(toInteger, toNumber
|
||||
var func = Math[methodName];
|
||||
return function(number, precision) {
|
||||
number = toNumber(number);
|
||||
precision = nativeMin(toInteger(precision), 292);
|
||||
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
|
||||
if (precision) {
|
||||
// Shift with exponential notation to avoid floating-point issues.
|
||||
// See [MDN](https://mdn.io/round#Examples) for more details.
|
||||
|
||||
@@ -77,7 +77,7 @@ define(['./_baseSetData', './_createBind', './_createCurry', './_createHybrid',
|
||||
thisArg = newData[2];
|
||||
partials = newData[3];
|
||||
holders = newData[4];
|
||||
arity = newData[9] = newData[9] == null
|
||||
arity = newData[9] = newData[9] === undefined
|
||||
? (isBindKey ? 0 : func.length)
|
||||
: nativeMax(newData[9] - length, 0);
|
||||
|
||||
|
||||
@@ -10,7 +10,9 @@ define(['./eq'], function(eq) {
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Used by `_.defaults` to customize its `_.assignIn` use.
|
||||
* Used by `_.defaults` to customize its `_.assignIn` use to assign properties
|
||||
* of source objects to the destination object for all destination properties
|
||||
* that resolve to `undefined`.
|
||||
*
|
||||
* @private
|
||||
* @param {*} objValue The destination value.
|
||||
@@ -19,7 +21,7 @@ define(['./eq'], function(eq) {
|
||||
* @param {Object} object The parent object of `objValue`.
|
||||
* @returns {*} Returns the value to assign.
|
||||
*/
|
||||
function assignInDefaults(objValue, srcValue, key, object) {
|
||||
function customDefaultsAssignIn(objValue, srcValue, key, object) {
|
||||
if (objValue === undefined ||
|
||||
(eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
|
||||
return srcValue;
|
||||
@@ -27,5 +29,5 @@ define(['./eq'], function(eq) {
|
||||
return objValue;
|
||||
}
|
||||
|
||||
return assignInDefaults;
|
||||
return customDefaultsAssignIn;
|
||||
});
|
||||
@@ -4,7 +4,8 @@ define(['./_baseMerge', './isObject'], function(baseMerge, isObject) {
|
||||
var undefined;
|
||||
|
||||
/**
|
||||
* Used by `_.defaultsDeep` to customize its `_.merge` use.
|
||||
* Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
|
||||
* objects into destination objects that are passed thru.
|
||||
*
|
||||
* @private
|
||||
* @param {*} objValue The destination value.
|
||||
@@ -16,15 +17,15 @@ define(['./_baseMerge', './isObject'], function(baseMerge, isObject) {
|
||||
* counterparts.
|
||||
* @returns {*} Returns the value to assign.
|
||||
*/
|
||||
function mergeDefaults(objValue, srcValue, key, object, source, stack) {
|
||||
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
|
||||
if (isObject(objValue) && isObject(srcValue)) {
|
||||
// Recursively merge objects and arrays (susceptible to call stack limits).
|
||||
stack.set(srcValue, objValue);
|
||||
baseMerge(objValue, srcValue, undefined, mergeDefaults, stack);
|
||||
baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
|
||||
stack['delete'](srcValue);
|
||||
}
|
||||
return objValue;
|
||||
}
|
||||
|
||||
return mergeDefaults;
|
||||
return customDefaultsMerge;
|
||||
});
|
||||
20
_customOmitClone.js
Normal file
20
_customOmitClone.js
Normal file
@@ -0,0 +1,20 @@
|
||||
define(['./isPlainObject'], function(isPlainObject) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/**
|
||||
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
|
||||
* objects.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to inspect.
|
||||
* @param {string} key The key of the property to inspect.
|
||||
* @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
|
||||
*/
|
||||
function customOmitClone(value) {
|
||||
return isPlainObject(value) ? undefined : value;
|
||||
}
|
||||
|
||||
return customOmitClone;
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./keys'], function(keys) {
|
||||
define(['./_getAllKeys'], function(getAllKeys) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -27,9 +27,9 @@ define(['./keys'], function(keys) {
|
||||
*/
|
||||
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
||||
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
||||
objProps = keys(object),
|
||||
objProps = getAllKeys(object),
|
||||
objLength = objProps.length,
|
||||
othProps = keys(other),
|
||||
othProps = getAllKeys(other),
|
||||
othLength = othProps.length;
|
||||
|
||||
if (objLength != othLength && !isPartial) {
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
define(['./_overArg', './stubArray'], function(overArg, stubArray) {
|
||||
define(['./_arrayFilter', './stubArray'], function(arrayFilter, stubArray) {
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Built-in value references. */
|
||||
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
||||
@@ -10,7 +16,15 @@ define(['./_overArg', './stubArray'], function(overArg, stubArray) {
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array} Returns the array of symbols.
|
||||
*/
|
||||
var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;
|
||||
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
||||
if (object == null) {
|
||||
return [];
|
||||
}
|
||||
object = Object(object);
|
||||
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
||||
return propertyIsEnumerable.call(object, symbol);
|
||||
});
|
||||
};
|
||||
|
||||
return getSymbols;
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ define(['./_nativeCreate'], function(nativeCreate) {
|
||||
*/
|
||||
function hashHas(key) {
|
||||
var data = this.__data__;
|
||||
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
|
||||
return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
|
||||
}
|
||||
|
||||
return hashHas;
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
define(['./_baseWrapperValue', './_getView', './isArray'], function(baseWrapperValue, getView, isArray) {
|
||||
|
||||
/** Used as the size to enable large array optimizations. */
|
||||
var LARGE_ARRAY_SIZE = 200;
|
||||
|
||||
/** Used to indicate the type of lazy iteratees. */
|
||||
var LAZY_FILTER_FLAG = 1,
|
||||
LAZY_MAP_FLAG = 2;
|
||||
@@ -34,8 +31,7 @@ define(['./_baseWrapperValue', './_getView', './isArray'], function(baseWrapperV
|
||||
resIndex = 0,
|
||||
takeCount = nativeMin(length, this.__takeCount__);
|
||||
|
||||
if (!isArr || arrLength < LARGE_ARRAY_SIZE ||
|
||||
(arrLength == length && takeCount == length)) {
|
||||
if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
|
||||
return baseWrapperValue(array, this.__actions__);
|
||||
}
|
||||
var result = [];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_apply', './_assignInDefaults', './assignInWith', './_baseRest'], function(apply, assignInDefaults, assignInWith, baseRest) {
|
||||
define(['./_apply', './assignInWith', './_baseRest', './_customDefaultsAssignIn'], function(apply, assignInWith, baseRest, customDefaultsAssignIn) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -25,7 +25,7 @@ define(['./_apply', './_assignInDefaults', './assignInWith', './_baseRest'], fun
|
||||
* // => { 'a': 1, 'b': 2 }
|
||||
*/
|
||||
var defaults = baseRest(function(args) {
|
||||
args.push(undefined, assignInDefaults);
|
||||
args.push(undefined, customDefaultsAssignIn);
|
||||
return apply(assignInWith, undefined, args);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_apply', './_baseRest', './_mergeDefaults', './mergeWith'], function(apply, baseRest, mergeDefaults, mergeWith) {
|
||||
define(['./_apply', './_baseRest', './_customDefaultsMerge', './mergeWith'], function(apply, baseRest, customDefaultsMerge, mergeWith) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -23,7 +23,7 @@ define(['./_apply', './_baseRest', './_mergeDefaults', './mergeWith'], function(
|
||||
* // => { 'a': { 'b': 2, 'c': 3 } }
|
||||
*/
|
||||
var defaultsDeep = baseRest(function(args) {
|
||||
args.push(undefined, mergeDefaults);
|
||||
args.push(undefined, customDefaultsMerge);
|
||||
return apply(mergeWith, undefined, args);
|
||||
});
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ define(['./_baseIsEqual'], function(baseIsEqual) {
|
||||
* date objects, error objects, maps, numbers, `Object` objects, regexes,
|
||||
* sets, strings, symbols, and typed arrays. `Object` objects are compared
|
||||
* by their own, not inherited, enumerable properties. Functions and DOM
|
||||
* nodes are **not** supported.
|
||||
* nodes are compared by strict equality, i.e. `===`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
193
main.js
193
main.js
@@ -13,7 +13,7 @@
|
||||
var undefined;
|
||||
|
||||
/** Used as the semantic version number. */
|
||||
var VERSION = '4.17.2';
|
||||
var VERSION = '4.17.4';
|
||||
|
||||
/** Used as the size to enable large array optimizations. */
|
||||
var LARGE_ARRAY_SIZE = 200;
|
||||
@@ -1568,9 +1568,9 @@
|
||||
* Shortcut fusion is an optimization to merge iteratee calls; this avoids
|
||||
* the creation of intermediate arrays and can greatly reduce the number of
|
||||
* iteratee executions. Sections of a chain sequence qualify for shortcut
|
||||
* fusion if the section is applied to an array of at least `200` elements
|
||||
* and any iteratees accept only one argument. The heuristic for whether a
|
||||
* section qualifies for shortcut fusion is subject to change.
|
||||
* fusion if the section is applied to an array and iteratees accept only
|
||||
* one argument. The heuristic for whether a section qualifies for shortcut
|
||||
* fusion is subject to change.
|
||||
*
|
||||
* Chaining is supported in custom builds as long as the `_#value` method is
|
||||
* directly or indirectly included in the build.
|
||||
@@ -1729,8 +1729,8 @@
|
||||
|
||||
/**
|
||||
* By default, the template delimiters used by lodash are like those in
|
||||
* embedded Ruby (ERB). Change the following template settings to use
|
||||
* alternative delimiters.
|
||||
* embedded Ruby (ERB) as well as ES2015 template strings. Change the
|
||||
* following template settings to use alternative delimiters.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -1877,8 +1877,7 @@
|
||||
resIndex = 0,
|
||||
takeCount = nativeMin(length, this.__takeCount__);
|
||||
|
||||
if (!isArr || arrLength < LARGE_ARRAY_SIZE ||
|
||||
(arrLength == length && takeCount == length)) {
|
||||
if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
|
||||
return baseWrapperValue(array, this.__actions__);
|
||||
}
|
||||
var result = [];
|
||||
@@ -1992,7 +1991,7 @@
|
||||
*/
|
||||
function hashHas(key) {
|
||||
var data = this.__data__;
|
||||
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
|
||||
return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2465,24 +2464,6 @@
|
||||
return shuffleSelf(copyArray(array));
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by `_.defaults` to customize its `_.assignIn` use.
|
||||
*
|
||||
* @private
|
||||
* @param {*} objValue The destination value.
|
||||
* @param {*} srcValue The source value.
|
||||
* @param {string} key The key of the property to assign.
|
||||
* @param {Object} object The parent object of `objValue`.
|
||||
* @returns {*} Returns the value to assign.
|
||||
*/
|
||||
function assignInDefaults(objValue, srcValue, key, object) {
|
||||
if (objValue === undefined ||
|
||||
(eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
|
||||
return srcValue;
|
||||
}
|
||||
return objValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is like `assignValue` except that it doesn't assign
|
||||
* `undefined` values.
|
||||
@@ -3095,8 +3076,7 @@
|
||||
if (value == null) {
|
||||
return value === undefined ? undefinedTag : nullTag;
|
||||
}
|
||||
value = Object(value);
|
||||
return (symToStringTag && symToStringTag in value)
|
||||
return (symToStringTag && symToStringTag in Object(value))
|
||||
? getRawTag(value)
|
||||
: objectToString(value);
|
||||
}
|
||||
@@ -3300,7 +3280,7 @@
|
||||
if (value === other) {
|
||||
return true;
|
||||
}
|
||||
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
|
||||
if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
|
||||
return value !== value && other !== other;
|
||||
}
|
||||
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
||||
@@ -3323,17 +3303,12 @@
|
||||
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
||||
var objIsArr = isArray(object),
|
||||
othIsArr = isArray(other),
|
||||
objTag = arrayTag,
|
||||
othTag = arrayTag;
|
||||
objTag = objIsArr ? arrayTag : getTag(object),
|
||||
othTag = othIsArr ? arrayTag : getTag(other);
|
||||
|
||||
objTag = objTag == argsTag ? objectTag : objTag;
|
||||
othTag = othTag == argsTag ? objectTag : othTag;
|
||||
|
||||
if (!objIsArr) {
|
||||
objTag = getTag(object);
|
||||
objTag = objTag == argsTag ? objectTag : objTag;
|
||||
}
|
||||
if (!othIsArr) {
|
||||
othTag = getTag(other);
|
||||
othTag = othTag == argsTag ? objectTag : othTag;
|
||||
}
|
||||
var objIsObj = objTag == objectTag,
|
||||
othIsObj = othTag == objectTag,
|
||||
isSameTag = objTag == othTag;
|
||||
@@ -3781,7 +3756,6 @@
|
||||
* @returns {Object} Returns the new object.
|
||||
*/
|
||||
function basePick(object, paths) {
|
||||
object = Object(object);
|
||||
return basePickBy(object, paths, function(value, path) {
|
||||
return hasIn(object, path);
|
||||
});
|
||||
@@ -5174,8 +5148,7 @@
|
||||
var args = arguments,
|
||||
value = args[0];
|
||||
|
||||
if (wrapper && args.length == 1 &&
|
||||
isArray(value) && value.length >= LARGE_ARRAY_SIZE) {
|
||||
if (wrapper && args.length == 1 && isArray(value)) {
|
||||
return wrapper.plant(value).value();
|
||||
}
|
||||
var index = 0,
|
||||
@@ -5482,7 +5455,7 @@
|
||||
var func = Math[methodName];
|
||||
return function(number, precision) {
|
||||
number = toNumber(number);
|
||||
precision = nativeMin(toInteger(precision), 292);
|
||||
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
|
||||
if (precision) {
|
||||
// Shift with exponential notation to avoid floating-point issues.
|
||||
// See [MDN](https://mdn.io/round#Examples) for more details.
|
||||
@@ -5587,7 +5560,7 @@
|
||||
thisArg = newData[2];
|
||||
partials = newData[3];
|
||||
holders = newData[4];
|
||||
arity = newData[9] = newData[9] == null
|
||||
arity = newData[9] = newData[9] === undefined
|
||||
? (isBindKey ? 0 : func.length)
|
||||
: nativeMax(newData[9] - length, 0);
|
||||
|
||||
@@ -5607,6 +5580,63 @@
|
||||
return setWrapToString(setter(result, newData), func, bitmask);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by `_.defaults` to customize its `_.assignIn` use to assign properties
|
||||
* of source objects to the destination object for all destination properties
|
||||
* that resolve to `undefined`.
|
||||
*
|
||||
* @private
|
||||
* @param {*} objValue The destination value.
|
||||
* @param {*} srcValue The source value.
|
||||
* @param {string} key The key of the property to assign.
|
||||
* @param {Object} object The parent object of `objValue`.
|
||||
* @returns {*} Returns the value to assign.
|
||||
*/
|
||||
function customDefaultsAssignIn(objValue, srcValue, key, object) {
|
||||
if (objValue === undefined ||
|
||||
(eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
|
||||
return srcValue;
|
||||
}
|
||||
return objValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
|
||||
* objects into destination objects that are passed thru.
|
||||
*
|
||||
* @private
|
||||
* @param {*} objValue The destination value.
|
||||
* @param {*} srcValue The source value.
|
||||
* @param {string} key The key of the property to merge.
|
||||
* @param {Object} object The parent object of `objValue`.
|
||||
* @param {Object} source The parent object of `srcValue`.
|
||||
* @param {Object} [stack] Tracks traversed source values and their merged
|
||||
* counterparts.
|
||||
* @returns {*} Returns the value to assign.
|
||||
*/
|
||||
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
|
||||
if (isObject(objValue) && isObject(srcValue)) {
|
||||
// Recursively merge objects and arrays (susceptible to call stack limits).
|
||||
stack.set(srcValue, objValue);
|
||||
baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
|
||||
stack['delete'](srcValue);
|
||||
}
|
||||
return objValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
|
||||
* objects.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to inspect.
|
||||
* @param {string} key The key of the property to inspect.
|
||||
* @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
|
||||
*/
|
||||
function customOmitClone(value) {
|
||||
return isPlainObject(value) ? undefined : value;
|
||||
}
|
||||
|
||||
/**
|
||||
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
||||
* partial deep comparisons.
|
||||
@@ -5778,9 +5808,9 @@
|
||||
*/
|
||||
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
||||
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
||||
objProps = keys(object),
|
||||
objProps = getAllKeys(object),
|
||||
objLength = objProps.length,
|
||||
othProps = keys(other),
|
||||
othProps = getAllKeys(other),
|
||||
othLength = othProps.length;
|
||||
|
||||
if (objLength != othLength && !isPartial) {
|
||||
@@ -6018,7 +6048,15 @@
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array} Returns the array of symbols.
|
||||
*/
|
||||
var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;
|
||||
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
||||
if (object == null) {
|
||||
return [];
|
||||
}
|
||||
object = Object(object);
|
||||
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
||||
return propertyIsEnumerable.call(object, symbol);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates an array of the own and inherited enumerable symbols of `object`.
|
||||
@@ -6504,29 +6542,6 @@
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by `_.defaultsDeep` to customize its `_.merge` use.
|
||||
*
|
||||
* @private
|
||||
* @param {*} objValue The destination value.
|
||||
* @param {*} srcValue The source value.
|
||||
* @param {string} key The key of the property to merge.
|
||||
* @param {Object} object The parent object of `objValue`.
|
||||
* @param {Object} source The parent object of `srcValue`.
|
||||
* @param {Object} [stack] Tracks traversed source values and their merged
|
||||
* counterparts.
|
||||
* @returns {*} Returns the value to assign.
|
||||
*/
|
||||
function mergeDefaults(objValue, srcValue, key, object, source, stack) {
|
||||
if (isObject(objValue) && isObject(srcValue)) {
|
||||
// Recursively merge objects and arrays (susceptible to call stack limits).
|
||||
stack.set(srcValue, objValue);
|
||||
baseMerge(objValue, srcValue, undefined, mergeDefaults, stack);
|
||||
stack['delete'](srcValue);
|
||||
}
|
||||
return objValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is like
|
||||
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
||||
@@ -8269,7 +8284,7 @@
|
||||
*
|
||||
* var users = [
|
||||
* { 'user': 'barney', 'active': false },
|
||||
* { 'user': 'fred', 'active': false},
|
||||
* { 'user': 'fred', 'active': false },
|
||||
* { 'user': 'pebbles', 'active': true }
|
||||
* ];
|
||||
*
|
||||
@@ -10838,7 +10853,7 @@
|
||||
if (typeof func != 'function') {
|
||||
throw new TypeError(FUNC_ERROR_TEXT);
|
||||
}
|
||||
start = start === undefined ? 0 : nativeMax(toInteger(start), 0);
|
||||
start = start == null ? 0 : nativeMax(toInteger(start), 0);
|
||||
return baseRest(function(args) {
|
||||
var array = args[start],
|
||||
otherArgs = castSlice(args, 0, start);
|
||||
@@ -11508,7 +11523,7 @@
|
||||
* date objects, error objects, maps, numbers, `Object` objects, regexes,
|
||||
* sets, strings, symbols, and typed arrays. `Object` objects are compared
|
||||
* by their own, not inherited, enumerable properties. Functions and DOM
|
||||
* nodes are **not** supported.
|
||||
* nodes are compared by strict equality, i.e. `===`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -12528,7 +12543,9 @@
|
||||
* // => 3
|
||||
*/
|
||||
function toSafeInteger(value) {
|
||||
return baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
|
||||
return value
|
||||
? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
|
||||
: (value === 0 ? value : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -12782,7 +12799,7 @@
|
||||
* // => { 'a': 1, 'b': 2 }
|
||||
*/
|
||||
var defaults = baseRest(function(args) {
|
||||
args.push(undefined, assignInDefaults);
|
||||
args.push(undefined, customDefaultsAssignIn);
|
||||
return apply(assignInWith, undefined, args);
|
||||
});
|
||||
|
||||
@@ -12806,7 +12823,7 @@
|
||||
* // => { 'a': { 'b': 2, 'c': 3 } }
|
||||
*/
|
||||
var defaultsDeep = baseRest(function(args) {
|
||||
args.push(undefined, mergeDefaults);
|
||||
args.push(undefined, customDefaultsMerge);
|
||||
return apply(mergeWith, undefined, args);
|
||||
});
|
||||
|
||||
@@ -13468,7 +13485,7 @@
|
||||
});
|
||||
copyObject(object, getAllKeysIn(object), result);
|
||||
if (isDeep) {
|
||||
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG);
|
||||
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
|
||||
}
|
||||
var length = paths.length;
|
||||
while (length--) {
|
||||
@@ -14617,7 +14634,10 @@
|
||||
*/
|
||||
function startsWith(string, target, position) {
|
||||
string = toString(string);
|
||||
position = baseClamp(toInteger(position), 0, string.length);
|
||||
position = position == null
|
||||
? 0
|
||||
: baseClamp(toInteger(position), 0, string.length);
|
||||
|
||||
target = baseToString(target);
|
||||
return string.slice(position, position + target.length) == target;
|
||||
}
|
||||
@@ -14736,9 +14756,9 @@
|
||||
options = undefined;
|
||||
}
|
||||
string = toString(string);
|
||||
options = assignInWith({}, options, settings, assignInDefaults);
|
||||
options = assignInWith({}, options, settings, customDefaultsAssignIn);
|
||||
|
||||
var imports = assignInWith({}, options.imports, settings.imports, assignInDefaults),
|
||||
var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
|
||||
importsKeys = keys(imports),
|
||||
importsValues = baseValues(imports, importsKeys);
|
||||
|
||||
@@ -16822,14 +16842,13 @@
|
||||
// Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
|
||||
arrayEach(['drop', 'take'], function(methodName, index) {
|
||||
LazyWrapper.prototype[methodName] = function(n) {
|
||||
var filtered = this.__filtered__;
|
||||
if (filtered && !index) {
|
||||
return new LazyWrapper(this);
|
||||
}
|
||||
n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
|
||||
|
||||
var result = this.clone();
|
||||
if (filtered) {
|
||||
var result = (this.__filtered__ && !index)
|
||||
? new LazyWrapper(this)
|
||||
: this.clone();
|
||||
|
||||
if (result.__filtered__) {
|
||||
result.__takeCount__ = nativeMin(n, result.__takeCount__);
|
||||
} else {
|
||||
result.__views__.push({
|
||||
|
||||
4
omit.js
4
omit.js
@@ -1,4 +1,4 @@
|
||||
define(['./_arrayMap', './_baseClone', './_baseUnset', './_castPath', './_copyObject', './_flatRest', './_getAllKeysIn'], function(arrayMap, baseClone, baseUnset, castPath, copyObject, flatRest, getAllKeysIn) {
|
||||
define(['./_arrayMap', './_baseClone', './_baseUnset', './_castPath', './_copyObject', './_customOmitClone', './_flatRest', './_getAllKeysIn'], function(arrayMap, baseClone, baseUnset, castPath, copyObject, customOmitClone, flatRest, getAllKeysIn) {
|
||||
|
||||
/** Used to compose bitmasks for cloning. */
|
||||
var CLONE_DEEP_FLAG = 1,
|
||||
@@ -38,7 +38,7 @@ define(['./_arrayMap', './_baseClone', './_baseUnset', './_castPath', './_copyOb
|
||||
});
|
||||
copyObject(object, getAllKeysIn(object), result);
|
||||
if (isDeep) {
|
||||
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG);
|
||||
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
|
||||
}
|
||||
var length = paths.length;
|
||||
while (length--) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lodash-amd",
|
||||
"version": "4.17.2",
|
||||
"version": "4.17.4",
|
||||
"description": "Lodash exported as AMD modules.",
|
||||
"keywords": "amd, modules, stdlib, util",
|
||||
"homepage": "https://lodash.com/custom-builds",
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
define(['./_apply', './_arrayPush', './_baseRest', './_castSlice', './toInteger'], function(apply, arrayPush, baseRest, castSlice, toInteger) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/** Error message constants. */
|
||||
var FUNC_ERROR_TEXT = 'Expected a function';
|
||||
|
||||
@@ -47,7 +44,7 @@ define(['./_apply', './_arrayPush', './_baseRest', './_castSlice', './toInteger'
|
||||
if (typeof func != 'function') {
|
||||
throw new TypeError(FUNC_ERROR_TEXT);
|
||||
}
|
||||
start = start === undefined ? 0 : nativeMax(toInteger(start), 0);
|
||||
start = start == null ? 0 : nativeMax(toInteger(start), 0);
|
||||
return baseRest(function(args) {
|
||||
var array = args[start],
|
||||
otherArgs = castSlice(args, 0, start);
|
||||
|
||||
@@ -25,7 +25,10 @@ define(['./_baseClamp', './_baseToString', './toInteger', './toString'], functio
|
||||
*/
|
||||
function startsWith(string, target, position) {
|
||||
string = toString(string);
|
||||
position = baseClamp(toInteger(position), 0, string.length);
|
||||
position = position == null
|
||||
? 0
|
||||
: baseClamp(toInteger(position), 0, string.length);
|
||||
|
||||
target = baseToString(target);
|
||||
return string.slice(position, position + target.length) == target;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ define(['./_baseIteratee', './_baseWhile'], function(baseIteratee, baseWhile) {
|
||||
*
|
||||
* var users = [
|
||||
* { 'user': 'barney', 'active': false },
|
||||
* { 'user': 'fred', 'active': false},
|
||||
* { 'user': 'fred', 'active': false },
|
||||
* { 'user': 'pebbles', 'active': true }
|
||||
* ];
|
||||
*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_assignInDefaults', './assignInWith', './attempt', './_baseValues', './_escapeStringChar', './isError', './_isIterateeCall', './keys', './_reInterpolate', './templateSettings', './toString'], function(assignInDefaults, assignInWith, attempt, baseValues, escapeStringChar, isError, isIterateeCall, keys, reInterpolate, templateSettings, toString) {
|
||||
define(['./assignInWith', './attempt', './_baseValues', './_customDefaultsAssignIn', './_escapeStringChar', './isError', './_isIterateeCall', './keys', './_reInterpolate', './templateSettings', './toString'], function(assignInWith, attempt, baseValues, customDefaultsAssignIn, escapeStringChar, isError, isIterateeCall, keys, reInterpolate, templateSettings, toString) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -134,9 +134,9 @@ define(['./_assignInDefaults', './assignInWith', './attempt', './_baseValues', '
|
||||
options = undefined;
|
||||
}
|
||||
string = toString(string);
|
||||
options = assignInWith({}, options, settings, assignInDefaults);
|
||||
options = assignInWith({}, options, settings, customDefaultsAssignIn);
|
||||
|
||||
var imports = assignInWith({}, options.imports, settings.imports, assignInDefaults),
|
||||
var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
|
||||
importsKeys = keys(imports),
|
||||
importsValues = baseValues(imports, importsKeys);
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ define(['./escape', './_reEscape', './_reEvaluate', './_reInterpolate'], functio
|
||||
|
||||
/**
|
||||
* By default, the template delimiters used by lodash are like those in
|
||||
* embedded Ruby (ERB). Change the following template settings to use
|
||||
* alternative delimiters.
|
||||
* embedded Ruby (ERB) as well as ES2015 template strings. Change the
|
||||
* following template settings to use alternative delimiters.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -28,7 +28,9 @@ define(['./_baseClamp', './toInteger'], function(baseClamp, toInteger) {
|
||||
* // => 3
|
||||
*/
|
||||
function toSafeInteger(value) {
|
||||
return baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
|
||||
return value
|
||||
? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
|
||||
: (value === 0 ? value : 0);
|
||||
}
|
||||
|
||||
return toSafeInteger;
|
||||
|
||||
@@ -24,9 +24,9 @@ define(['./_LazyWrapper', './_LodashWrapper', './_baseLodash', './isArray', './i
|
||||
* Shortcut fusion is an optimization to merge iteratee calls; this avoids
|
||||
* the creation of intermediate arrays and can greatly reduce the number of
|
||||
* iteratee executions. Sections of a chain sequence qualify for shortcut
|
||||
* fusion if the section is applied to an array of at least `200` elements
|
||||
* and any iteratees accept only one argument. The heuristic for whether a
|
||||
* section qualifies for shortcut fusion is subject to change.
|
||||
* fusion if the section is applied to an array and iteratees accept only
|
||||
* one argument. The heuristic for whether a section qualifies for shortcut
|
||||
* fusion is subject to change.
|
||||
*
|
||||
* Chaining is supported in custom builds as long as the `_#value` method is
|
||||
* directly or indirectly included in the build.
|
||||
|
||||
Reference in New Issue
Block a user