mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +00:00
Bump to v3.6.0.
This commit is contained in:
@@ -2,7 +2,7 @@ define([], function() {
|
||||
|
||||
/**
|
||||
* A specialized version of `_.forEach` for arrays without support for callback
|
||||
* shorthands or `this` binding.
|
||||
* shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
|
||||
@@ -2,7 +2,7 @@ define([], function() {
|
||||
|
||||
/**
|
||||
* A specialized version of `_.forEachRight` for arrays without support for
|
||||
* callback shorthands or `this` binding.
|
||||
* callback shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
|
||||
@@ -2,7 +2,7 @@ define([], function() {
|
||||
|
||||
/**
|
||||
* A specialized version of `_.every` for arrays without support for callback
|
||||
* shorthands or `this` binding.
|
||||
* shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
|
||||
@@ -2,7 +2,7 @@ define([], function() {
|
||||
|
||||
/**
|
||||
* A specialized version of `_.filter` for arrays without support for callback
|
||||
* shorthands or `this` binding.
|
||||
* shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
|
||||
@@ -2,7 +2,7 @@ define([], function() {
|
||||
|
||||
/**
|
||||
* A specialized version of `_.map` for arrays without support for callback
|
||||
* shorthands or `this` binding.
|
||||
* shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
|
||||
@@ -2,7 +2,7 @@ define([], function() {
|
||||
|
||||
/**
|
||||
* A specialized version of `_.reduce` for arrays without support for callback
|
||||
* shorthands or `this` binding.
|
||||
* shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
|
||||
@@ -2,7 +2,7 @@ define([], function() {
|
||||
|
||||
/**
|
||||
* A specialized version of `_.reduceRight` for arrays without support for
|
||||
* callback shorthands or `this` binding.
|
||||
* callback shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
|
||||
@@ -2,7 +2,7 @@ define([], function() {
|
||||
|
||||
/**
|
||||
* A specialized version of `_.some` for arrays without support for callback
|
||||
* shorthands or `this` binding.
|
||||
* shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
|
||||
21
internal/arraySum.js
Normal file
21
internal/arraySum.js
Normal file
@@ -0,0 +1,21 @@
|
||||
define([], function() {
|
||||
|
||||
/**
|
||||
* A specialized version of `_.sum` for arrays without support for iteratees.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @returns {number} Returns the sum.
|
||||
*/
|
||||
function arraySum(array) {
|
||||
var length = array.length,
|
||||
result = 0;
|
||||
|
||||
while (length--) {
|
||||
result += +array[length] || 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return arraySum;
|
||||
});
|
||||
@@ -1,27 +0,0 @@
|
||||
define(['./createWrapper'], function(createWrapper) {
|
||||
|
||||
/** Used to compose bitmasks for wrapper metadata. */
|
||||
var BIND_FLAG = 1;
|
||||
|
||||
/**
|
||||
* The base implementation of `_.bindAll` without support for individual
|
||||
* method name arguments.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to bind and assign the bound methods to.
|
||||
* @param {string[]} methodNames The object method names to bind.
|
||||
* @returns {Object} Returns `object`.
|
||||
*/
|
||||
function baseBindAll(object, methodNames) {
|
||||
var index = -1,
|
||||
length = methodNames.length;
|
||||
|
||||
while (++index < length) {
|
||||
var key = methodNames[index];
|
||||
object[key] = createWrapper(object[key], BIND_FLAG, object);
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
return baseBindAll;
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./baseMatches', './baseMatchesProperty', './baseProperty', './bindCallback', '../utility/identity', './isBindable'], function(baseMatches, baseMatchesProperty, baseProperty, bindCallback, identity, isBindable) {
|
||||
define(['./baseMatches', './baseMatchesProperty', './baseProperty', './bindCallback', '../utility/identity'], function(baseMatches, baseMatchesProperty, baseProperty, bindCallback, identity) {
|
||||
|
||||
/**
|
||||
* The base implementation of `_.callback` which supports specifying the
|
||||
@@ -13,9 +13,9 @@ define(['./baseMatches', './baseMatchesProperty', './baseProperty', './bindCallb
|
||||
function baseCallback(func, thisArg, argCount) {
|
||||
var type = typeof func;
|
||||
if (type == 'function') {
|
||||
return (typeof thisArg != 'undefined' && isBindable(func))
|
||||
? bindCallback(func, thisArg, argCount)
|
||||
: func;
|
||||
return typeof thisArg == 'undefined'
|
||||
? func
|
||||
: bindCallback(func, thisArg, argCount);
|
||||
}
|
||||
if (func == null) {
|
||||
return identity;
|
||||
|
||||
@@ -45,9 +45,8 @@ define(['./arrayCopy', './arrayEach', './baseCopy', './baseForOwn', './initClone
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the `toStringTag` of values.
|
||||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring)
|
||||
* for more details.
|
||||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objToString = objectProto.toString;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./baseSlice'], function(baseSlice) {
|
||||
define([], function() {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -13,14 +13,14 @@ define(['./baseSlice'], function(baseSlice) {
|
||||
* @private
|
||||
* @param {Function} func The function to delay.
|
||||
* @param {number} wait The number of milliseconds to delay invocation.
|
||||
* @param {Object} args The `arguments` object to slice and provide to `func`.
|
||||
* @param {Object} args The arguments provide to `func`.
|
||||
* @returns {number} Returns the timer id.
|
||||
*/
|
||||
function baseDelay(func, wait, args, fromIndex) {
|
||||
function baseDelay(func, wait, args) {
|
||||
if (typeof func != 'function') {
|
||||
throw new TypeError(FUNC_ERROR_TEXT);
|
||||
}
|
||||
return setTimeout(function() { func.apply(undefined, baseSlice(args, fromIndex)); }, wait);
|
||||
return setTimeout(function() { func.apply(undefined, args); }, wait);
|
||||
}
|
||||
|
||||
return baseDelay;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./baseForOwn', './isLength', './toObject'], function(baseForOwn, isLength, toObject) {
|
||||
define(['./baseForOwn', './createBaseEach'], function(baseForOwn, createBaseEach) {
|
||||
|
||||
/**
|
||||
* The base implementation of `_.forEach` without support for callback
|
||||
@@ -9,21 +9,7 @@ define(['./baseForOwn', './isLength', './toObject'], function(baseForOwn, isLeng
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @returns {Array|Object|string} Returns `collection`.
|
||||
*/
|
||||
function baseEach(collection, iteratee) {
|
||||
var length = collection ? collection.length : 0;
|
||||
if (!isLength(length)) {
|
||||
return baseForOwn(collection, iteratee);
|
||||
}
|
||||
var index = -1,
|
||||
iterable = toObject(collection);
|
||||
|
||||
while (++index < length) {
|
||||
if (iteratee(iterable[index], index, iterable) === false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return collection;
|
||||
}
|
||||
var baseEach = createBaseEach(baseForOwn);
|
||||
|
||||
return baseEach;
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./baseForOwnRight', './isLength', './toObject'], function(baseForOwnRight, isLength, toObject) {
|
||||
define(['./baseForOwnRight', './createBaseEach'], function(baseForOwnRight, createBaseEach) {
|
||||
|
||||
/**
|
||||
* The base implementation of `_.forEachRight` without support for callback
|
||||
@@ -9,19 +9,7 @@ define(['./baseForOwnRight', './isLength', './toObject'], function(baseForOwnRig
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @returns {Array|Object|string} Returns `collection`.
|
||||
*/
|
||||
function baseEachRight(collection, iteratee) {
|
||||
var length = collection ? collection.length : 0;
|
||||
if (!isLength(length)) {
|
||||
return baseForOwnRight(collection, iteratee);
|
||||
}
|
||||
var iterable = toObject(collection);
|
||||
while (length--) {
|
||||
if (iteratee(iterable[length], length, iterable) === false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return collection;
|
||||
}
|
||||
var baseEachRight = createBaseEach(baseForOwnRight, true);
|
||||
|
||||
return baseEachRight;
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ define(['./baseEach'], function(baseEach) {
|
||||
|
||||
/**
|
||||
* The base implementation of `_.every` without support for callback
|
||||
* shorthands or `this` binding.
|
||||
* shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object|string} collection The collection to iterate over.
|
||||
|
||||
@@ -2,7 +2,7 @@ define(['./baseEach'], function(baseEach) {
|
||||
|
||||
/**
|
||||
* The base implementation of `_.filter` without support for callback
|
||||
* shorthands or `this` binding.
|
||||
* shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object|string} collection The collection to iterate over.
|
||||
|
||||
26
internal/baseFindIndex.js
Normal file
26
internal/baseFindIndex.js
Normal file
@@ -0,0 +1,26 @@
|
||||
define([], function() {
|
||||
|
||||
/**
|
||||
* The base implementation of `_.findIndex` and `_.findLastIndex` without
|
||||
* support for callback shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
*/
|
||||
function baseFindIndex(array, predicate, fromRight) {
|
||||
var length = array.length,
|
||||
index = fromRight ? length : -1;
|
||||
|
||||
while ((fromRight ? index-- : ++index < length)) {
|
||||
if (predicate(array[index], index, array)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
return baseFindIndex;
|
||||
});
|
||||
@@ -8,11 +8,10 @@ define(['../lang/isArguments', '../lang/isArray', './isLength', './isObjectLike'
|
||||
* @param {Array} array The array to flatten.
|
||||
* @param {boolean} isDeep Specify a deep flatten.
|
||||
* @param {boolean} isStrict Restrict flattening to arrays and `arguments` objects.
|
||||
* @param {number} fromIndex The index to start from.
|
||||
* @returns {Array} Returns the new flattened array.
|
||||
*/
|
||||
function baseFlatten(array, isDeep, isStrict, fromIndex) {
|
||||
var index = fromIndex - 1,
|
||||
function baseFlatten(array, isDeep, isStrict) {
|
||||
var index = -1,
|
||||
length = array.length,
|
||||
resIndex = -1,
|
||||
result = [];
|
||||
@@ -23,7 +22,7 @@ define(['../lang/isArguments', '../lang/isArray', './isLength', './isObjectLike'
|
||||
if (isObjectLike(value) && isLength(value.length) && (isArray(value) || isArguments(value))) {
|
||||
if (isDeep) {
|
||||
// Recursively flatten arrays (susceptible to call stack limits).
|
||||
value = baseFlatten(value, isDeep, isStrict, 0);
|
||||
value = baseFlatten(value, isDeep, isStrict);
|
||||
}
|
||||
var valIndex = -1,
|
||||
valLength = value.length;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./toObject'], function(toObject) {
|
||||
define(['./createBaseFor'], function(createBaseFor) {
|
||||
|
||||
/**
|
||||
* The base implementation of `baseForIn` and `baseForOwn` which iterates
|
||||
@@ -12,20 +12,7 @@ define(['./toObject'], function(toObject) {
|
||||
* @param {Function} keysFunc The function to get the keys of `object`.
|
||||
* @returns {Object} Returns `object`.
|
||||
*/
|
||||
function baseFor(object, iteratee, keysFunc) {
|
||||
var index = -1,
|
||||
iterable = toObject(object),
|
||||
props = keysFunc(object),
|
||||
length = props.length;
|
||||
|
||||
while (++index < length) {
|
||||
var key = props[index];
|
||||
if (iteratee(iterable[key], key, iterable) === false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return object;
|
||||
}
|
||||
var baseFor = createBaseFor();
|
||||
|
||||
return baseFor;
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./toObject'], function(toObject) {
|
||||
define(['./createBaseFor'], function(createBaseFor) {
|
||||
|
||||
/**
|
||||
* This function is like `baseFor` except that it iterates over properties
|
||||
@@ -10,19 +10,7 @@ define(['./toObject'], function(toObject) {
|
||||
* @param {Function} keysFunc The function to get the keys of `object`.
|
||||
* @returns {Object} Returns `object`.
|
||||
*/
|
||||
function baseForRight(object, iteratee, keysFunc) {
|
||||
var iterable = toObject(object),
|
||||
props = keysFunc(object),
|
||||
length = props.length;
|
||||
|
||||
while (length--) {
|
||||
var key = props[length];
|
||||
if (iteratee(iterable[key], key, iterable) === false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return object;
|
||||
}
|
||||
var baseForRight = createBaseFor(true);
|
||||
|
||||
return baseForRight;
|
||||
});
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
define(['./baseEach', './isLength'], function(baseEach, isLength) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/**
|
||||
* The base implementation of `_.invoke` which requires additional arguments
|
||||
* to be provided as an array of arguments rather than individually.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object|string} collection The collection to iterate over.
|
||||
* @param {Function|string} methodName The name of the method to invoke or
|
||||
* the function invoked per iteration.
|
||||
* @param {Array} [args] The arguments to invoke the method with.
|
||||
* @returns {Array} Returns the array of results.
|
||||
*/
|
||||
function baseInvoke(collection, methodName, args) {
|
||||
var index = -1,
|
||||
isFunc = typeof methodName == 'function',
|
||||
length = collection ? collection.length : 0,
|
||||
result = isLength(length) ? Array(length) : [];
|
||||
|
||||
baseEach(collection, function(value) {
|
||||
var func = isFunc ? methodName : (value != null && value[methodName]);
|
||||
result[++index] = func ? func.apply(value, args) : undefined;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
return baseInvoke;
|
||||
});
|
||||
@@ -8,12 +8,12 @@ define(['./baseIsEqualDeep'], function(baseIsEqualDeep) {
|
||||
* @param {*} value The value to compare.
|
||||
* @param {*} other The other value to compare.
|
||||
* @param {Function} [customizer] The function to customize comparing values.
|
||||
* @param {boolean} [isWhere] Specify performing partial comparisons.
|
||||
* @param {boolean} [isLoose] Specify performing partial comparisons.
|
||||
* @param {Array} [stackA] Tracks traversed `value` objects.
|
||||
* @param {Array} [stackB] Tracks traversed `other` objects.
|
||||
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
||||
*/
|
||||
function baseIsEqual(value, other, customizer, isWhere, stackA, stackB) {
|
||||
function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
|
||||
// Exit early for identical values.
|
||||
if (value === other) {
|
||||
// Treat `+0` vs. `-0` as not equal.
|
||||
@@ -28,7 +28,7 @@ define(['./baseIsEqualDeep'], function(baseIsEqualDeep) {
|
||||
// Return `false` unless both values are `NaN`.
|
||||
return value !== value && other !== other;
|
||||
}
|
||||
return baseIsEqualDeep(value, other, baseIsEqual, customizer, isWhere, stackA, stackB);
|
||||
return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
|
||||
}
|
||||
|
||||
return baseIsEqual;
|
||||
|
||||
@@ -3,6 +3,7 @@ define(['./equalArrays', './equalByTag', './equalObjects', '../lang/isArray', '.
|
||||
/** `Object#toString` result references. */
|
||||
var argsTag = '[object Arguments]',
|
||||
arrayTag = '[object Array]',
|
||||
funcTag = '[object Function]',
|
||||
objectTag = '[object Object]';
|
||||
|
||||
/** Used for native method references. */
|
||||
@@ -12,9 +13,8 @@ define(['./equalArrays', './equalByTag', './equalObjects', '../lang/isArray', '.
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Used to resolve the `toStringTag` of values.
|
||||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring)
|
||||
* for more details.
|
||||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objToString = objectProto.toString;
|
||||
|
||||
@@ -28,12 +28,12 @@ define(['./equalArrays', './equalByTag', './equalObjects', '../lang/isArray', '.
|
||||
* @param {Object} other The other object to compare.
|
||||
* @param {Function} equalFunc The function to determine equivalents of values.
|
||||
* @param {Function} [customizer] The function to customize comparing objects.
|
||||
* @param {boolean} [isWhere] Specify performing partial comparisons.
|
||||
* @param {boolean} [isLoose] Specify performing partial comparisons.
|
||||
* @param {Array} [stackA=[]] Tracks traversed `value` objects.
|
||||
* @param {Array} [stackB=[]] Tracks traversed `other` objects.
|
||||
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
||||
*/
|
||||
function baseIsEqualDeep(object, other, equalFunc, customizer, isWhere, stackA, stackB) {
|
||||
function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
|
||||
var objIsArr = isArray(object),
|
||||
othIsArr = isArray(other),
|
||||
objTag = arrayTag,
|
||||
@@ -55,21 +55,27 @@ define(['./equalArrays', './equalByTag', './equalObjects', '../lang/isArray', '.
|
||||
othIsArr = isTypedArray(other);
|
||||
}
|
||||
}
|
||||
var objIsObj = objTag == objectTag,
|
||||
othIsObj = othTag == objectTag,
|
||||
var objIsObj = (objTag == objectTag || (isLoose && objTag == funcTag)),
|
||||
othIsObj = (othTag == objectTag || (isLoose && othTag == funcTag)),
|
||||
isSameTag = objTag == othTag;
|
||||
|
||||
if (isSameTag && !(objIsArr || objIsObj)) {
|
||||
return equalByTag(object, other, objTag);
|
||||
}
|
||||
var valWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
||||
othWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
||||
if (isLoose) {
|
||||
if (!isSameTag && !(objIsObj && othIsObj)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
var valWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
||||
othWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
||||
|
||||
if (valWrapped || othWrapped) {
|
||||
return equalFunc(valWrapped ? object.value() : object, othWrapped ? other.value() : other, customizer, isWhere, stackA, stackB);
|
||||
}
|
||||
if (!isSameTag) {
|
||||
return false;
|
||||
if (valWrapped || othWrapped) {
|
||||
return equalFunc(valWrapped ? object.value() : object, othWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
|
||||
}
|
||||
if (!isSameTag) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Assume cyclic values are equal.
|
||||
// For more information on detecting circular references see https://es5.github.io/#JO.
|
||||
@@ -86,7 +92,7 @@ define(['./equalArrays', './equalByTag', './equalObjects', '../lang/isArray', '.
|
||||
stackA.push(object);
|
||||
stackB.push(other);
|
||||
|
||||
var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isWhere, stackA, stackB);
|
||||
var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);
|
||||
|
||||
stackA.pop();
|
||||
stackB.pop();
|
||||
|
||||
@@ -3,15 +3,9 @@ define(['./baseIsEqual'], function(baseIsEqual) {
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/** Used for native method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* The base implementation of `_.isMatch` without support for callback
|
||||
* shorthands or `this` binding.
|
||||
* shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to inspect.
|
||||
@@ -22,30 +16,27 @@ define(['./baseIsEqual'], function(baseIsEqual) {
|
||||
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
||||
*/
|
||||
function baseIsMatch(object, props, values, strictCompareFlags, customizer) {
|
||||
var length = props.length;
|
||||
if (object == null) {
|
||||
return !length;
|
||||
}
|
||||
var index = -1,
|
||||
length = props.length,
|
||||
noCustomizer = !customizer;
|
||||
|
||||
while (++index < length) {
|
||||
if ((noCustomizer && strictCompareFlags[index])
|
||||
? values[index] !== object[props[index]]
|
||||
: !hasOwnProperty.call(object, props[index])
|
||||
: !(props[index] in object)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
index = -1;
|
||||
while (++index < length) {
|
||||
var key = props[index];
|
||||
if (noCustomizer && strictCompareFlags[index]) {
|
||||
var result = hasOwnProperty.call(object, key);
|
||||
} else {
|
||||
var objValue = object[key],
|
||||
srcValue = values[index];
|
||||
var key = props[index],
|
||||
objValue = object[key],
|
||||
srcValue = values[index];
|
||||
|
||||
if (noCustomizer && strictCompareFlags[index]) {
|
||||
var result = typeof objValue != 'undefined' || (key in object);
|
||||
} else {
|
||||
result = customizer ? customizer(objValue, srcValue, key) : undefined;
|
||||
if (typeof result == 'undefined') {
|
||||
result = baseIsEqual(srcValue, objValue, customizer, true);
|
||||
|
||||
@@ -2,7 +2,7 @@ define(['./baseEach'], function(baseEach) {
|
||||
|
||||
/**
|
||||
* The base implementation of `_.map` without support for callback shorthands
|
||||
* or `this` binding.
|
||||
* and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object|string} collection The collection to iterate over.
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
define(['./baseIsMatch', './isStrictComparable', '../object/keys'], function(baseIsMatch, isStrictComparable, keys) {
|
||||
|
||||
/** Used for native method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
define(['./baseIsMatch', '../utility/constant', './isStrictComparable', '../object/keys', './toObject'], function(baseIsMatch, constant, isStrictComparable, keys, toObject) {
|
||||
|
||||
/**
|
||||
* The base implementation of `_.matches` which does not clone `source`.
|
||||
@@ -17,13 +11,17 @@ define(['./baseIsMatch', './isStrictComparable', '../object/keys'], function(bas
|
||||
var props = keys(source),
|
||||
length = props.length;
|
||||
|
||||
if (!length) {
|
||||
return constant(true);
|
||||
}
|
||||
if (length == 1) {
|
||||
var key = props[0],
|
||||
value = source[key];
|
||||
|
||||
if (isStrictComparable(value)) {
|
||||
return function(object) {
|
||||
return object != null && object[key] === value && hasOwnProperty.call(object, key);
|
||||
return object != null && object[key] === value &&
|
||||
(typeof value != 'undefined' || (key in toObject(object)));
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -36,7 +34,7 @@ define(['./baseIsMatch', './isStrictComparable', '../object/keys'], function(bas
|
||||
strictCompareFlags[length] = isStrictComparable(value);
|
||||
}
|
||||
return function(object) {
|
||||
return baseIsMatch(object, props, values, strictCompareFlags);
|
||||
return object != null && baseIsMatch(toObject(object), props, values, strictCompareFlags);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./baseIsEqual', './isStrictComparable'], function(baseIsEqual, isStrictComparable) {
|
||||
define(['./baseIsEqual', './isStrictComparable', './toObject'], function(baseIsEqual, isStrictComparable, toObject) {
|
||||
|
||||
/**
|
||||
* The base implementation of `_.matchesProperty` which does not coerce `key`
|
||||
@@ -12,7 +12,8 @@ define(['./baseIsEqual', './isStrictComparable'], function(baseIsEqual, isStrict
|
||||
function baseMatchesProperty(key, value) {
|
||||
if (isStrictComparable(value)) {
|
||||
return function(object) {
|
||||
return object != null && object[key] === value;
|
||||
return object != null && object[key] === value &&
|
||||
(typeof value != 'undefined' || (key in toObject(object)));
|
||||
};
|
||||
}
|
||||
return function(object) {
|
||||
|
||||
@@ -37,7 +37,7 @@ define(['./arrayCopy', '../lang/isArguments', '../lang/isArray', './isLength', '
|
||||
if (isLength(srcValue.length) && (isArray(srcValue) || isTypedArray(srcValue))) {
|
||||
result = isArray(value)
|
||||
? value
|
||||
: (value ? arrayCopy(value) : []);
|
||||
: ((value && value.length) ? arrayCopy(value) : []);
|
||||
}
|
||||
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
||||
result = isArguments(value)
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
define(['./baseAt', './baseCompareAscending', './isIndex'], function(baseAt, baseCompareAscending, isIndex) {
|
||||
|
||||
/** Used for native method references. */
|
||||
var arrayProto = Array.prototype;
|
||||
|
||||
/** Native method references. */
|
||||
var splice = arrayProto.splice;
|
||||
|
||||
/**
|
||||
* The base implementation of `_.pullAt` without support for individual
|
||||
* index arguments.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to modify.
|
||||
* @param {number[]} indexes The indexes of elements to remove.
|
||||
* @returns {Array} Returns the new array of removed elements.
|
||||
*/
|
||||
function basePullAt(array, indexes) {
|
||||
var length = indexes.length,
|
||||
result = baseAt(array, indexes);
|
||||
|
||||
indexes.sort(baseCompareAscending);
|
||||
while (length--) {
|
||||
var index = parseFloat(indexes[length]);
|
||||
if (index != previous && isIndex(index)) {
|
||||
var previous = index;
|
||||
splice.call(array, index, 1);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return basePullAt;
|
||||
});
|
||||
@@ -2,7 +2,7 @@ define([], function() {
|
||||
|
||||
/**
|
||||
* The base implementation of `_.reduce` and `_.reduceRight` without support
|
||||
* for callback shorthands or `this` binding, which iterates over `collection`
|
||||
* for callback shorthands and `this` binding, which iterates over `collection`
|
||||
* using the provided `eachFunc`.
|
||||
*
|
||||
* @private
|
||||
|
||||
@@ -2,7 +2,7 @@ define(['./baseEach'], function(baseEach) {
|
||||
|
||||
/**
|
||||
* The base implementation of `_.some` without support for callback shorthands
|
||||
* or `this` binding.
|
||||
* and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object|string} collection The collection to iterate over.
|
||||
|
||||
21
internal/baseSum.js
Normal file
21
internal/baseSum.js
Normal file
@@ -0,0 +1,21 @@
|
||||
define(['./baseEach'], function(baseEach) {
|
||||
|
||||
/**
|
||||
* The base implementation of `_.sum` without support for callback shorthands
|
||||
* and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object|string} collection The collection to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @returns {number} Returns the sum.
|
||||
*/
|
||||
function baseSum(collection, iteratee) {
|
||||
var result = 0;
|
||||
baseEach(collection, function(value, index, collection) {
|
||||
result += +iteratee(value, index, collection) || 0;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
return baseSum;
|
||||
});
|
||||
25
internal/baseWhile.js
Normal file
25
internal/baseWhile.js
Normal file
@@ -0,0 +1,25 @@
|
||||
define(['./baseSlice'], function(baseSlice) {
|
||||
|
||||
/**
|
||||
* The base implementation of `_.dropRightWhile`, `_.dropWhile`, `_.takeRightWhile`,
|
||||
* and `_.takeWhile` without support for callback shorthands and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to query.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @param {boolean} [isDrop] Specify dropping elements instead of taking them.
|
||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||||
* @returns {Array} Returns the slice of `array`.
|
||||
*/
|
||||
function baseWhile(array, predicate, isDrop, fromRight) {
|
||||
var length = array.length,
|
||||
index = fromRight ? length : -1;
|
||||
|
||||
while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {}
|
||||
return isDrop
|
||||
? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
|
||||
: baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
|
||||
}
|
||||
|
||||
return baseWhile;
|
||||
});
|
||||
@@ -14,7 +14,7 @@ define(['./LazyWrapper'], function(LazyWrapper) {
|
||||
* @private
|
||||
* @param {*} value The unwrapped value.
|
||||
* @param {Array} actions Actions to peform to resolve the unwrapped value.
|
||||
* @returns {*} Returns the resolved unwrapped value.
|
||||
* @returns {*} Returns the resolved value.
|
||||
*/
|
||||
function baseWrapperValue(value, actions) {
|
||||
var result = value;
|
||||
|
||||
@@ -11,8 +11,7 @@ define(['./binaryIndexBy', '../utility/identity'], function(binaryIndexBy, ident
|
||||
* @private
|
||||
* @param {Array} array The sorted array to inspect.
|
||||
* @param {*} value The value to evaluate.
|
||||
* @param {boolean} [retHighest] Specify returning the highest, instead
|
||||
* of the lowest, index at which a value should be inserted into `array`.
|
||||
* @param {boolean} [retHighest] Specify returning the highest qualified index.
|
||||
* @returns {number} Returns the index at which `value` should be inserted
|
||||
* into `array`.
|
||||
*/
|
||||
|
||||
@@ -19,8 +19,7 @@ define([], function() {
|
||||
* @param {Array} array The sorted array to inspect.
|
||||
* @param {*} value The value to evaluate.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @param {boolean} [retHighest] Specify returning the highest, instead
|
||||
* of the lowest, index at which a value should be inserted into `array`.
|
||||
* @param {boolean} [retHighest] Specify returning the highest qualified index.
|
||||
* @returns {number} Returns the index at which `value` should be inserted
|
||||
* into `array`.
|
||||
*/
|
||||
|
||||
@@ -5,6 +5,9 @@ define(['./baseCallback', './baseEach', '../lang/isArray'], function(baseCallbac
|
||||
* object composed from the results of running each element in the collection
|
||||
* through an iteratee.
|
||||
*
|
||||
* **Note:** This function is used to create `_.countBy`, `_.groupBy`, `_.indexBy`,
|
||||
* and `_.partition`.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} setter The function to set keys and values of the accumulator object.
|
||||
* @param {Function} [initializer] The function to initialize the accumulator object.
|
||||
|
||||
@@ -4,6 +4,8 @@ define(['./bindCallback', './isIterateeCall'], function(bindCallback, isIteratee
|
||||
* Creates a function that assigns properties of source object(s) to a given
|
||||
* destination object.
|
||||
*
|
||||
* **Note:** This function is used to create `_.assign`, `_.defaults`, and `_.merge`.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} assigner The function to assign values.
|
||||
* @returns {Function} Returns the new assigner function.
|
||||
|
||||
30
internal/createBaseEach.js
Normal file
30
internal/createBaseEach.js
Normal file
@@ -0,0 +1,30 @@
|
||||
define(['./isLength', './toObject'], function(isLength, toObject) {
|
||||
|
||||
/**
|
||||
* Creates a `baseEach` or `baseEachRight` function.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} eachFunc The function to iterate over a collection.
|
||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||||
* @returns {Function} Returns the new base function.
|
||||
*/
|
||||
function createBaseEach(eachFunc, fromRight) {
|
||||
return function(collection, iteratee) {
|
||||
var length = collection ? collection.length : 0;
|
||||
if (!isLength(length)) {
|
||||
return eachFunc(collection, iteratee);
|
||||
}
|
||||
var index = fromRight ? length : -1,
|
||||
iterable = toObject(collection);
|
||||
|
||||
while ((fromRight ? index-- : ++index < length)) {
|
||||
if (iteratee(iterable[index], index, iterable) === false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return collection;
|
||||
};
|
||||
}
|
||||
|
||||
return createBaseEach;
|
||||
});
|
||||
28
internal/createBaseFor.js
Normal file
28
internal/createBaseFor.js
Normal file
@@ -0,0 +1,28 @@
|
||||
define(['./toObject'], function(toObject) {
|
||||
|
||||
/**
|
||||
* Creates a base function for `_.forIn` or `_.forInRight`.
|
||||
*
|
||||
* @private
|
||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||||
* @returns {Function} Returns the new base function.
|
||||
*/
|
||||
function createBaseFor(fromRight) {
|
||||
return function(object, iteratee, keysFunc) {
|
||||
var iterable = toObject(object),
|
||||
props = keysFunc(object),
|
||||
length = props.length,
|
||||
index = fromRight ? length : -1;
|
||||
|
||||
while ((fromRight ? index-- : ++index < length)) {
|
||||
var key = props[index];
|
||||
if (iteratee(iterable[key], key, iterable) === false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return object;
|
||||
};
|
||||
}
|
||||
|
||||
return createBaseFor;
|
||||
});
|
||||
@@ -1,42 +0,0 @@
|
||||
define([], function() {
|
||||
|
||||
/** Used as the `TypeError` message for "Functions" methods. */
|
||||
var FUNC_ERROR_TEXT = 'Expected a function';
|
||||
|
||||
/**
|
||||
* Creates a function to compose other functions into a single function.
|
||||
*
|
||||
* @private
|
||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||||
* @returns {Function} Returns the new composer function.
|
||||
*/
|
||||
function createComposer(fromRight) {
|
||||
return function() {
|
||||
var length = arguments.length,
|
||||
index = length,
|
||||
fromIndex = fromRight ? (length - 1) : 0;
|
||||
|
||||
if (!length) {
|
||||
return function() { return arguments[0]; };
|
||||
}
|
||||
var funcs = Array(length);
|
||||
while (index--) {
|
||||
funcs[index] = arguments[index];
|
||||
if (typeof funcs[index] != 'function') {
|
||||
throw new TypeError(FUNC_ERROR_TEXT);
|
||||
}
|
||||
}
|
||||
return function() {
|
||||
var index = fromIndex,
|
||||
result = funcs[index].apply(this, arguments);
|
||||
|
||||
while ((fromRight ? index-- : ++index < length)) {
|
||||
result = funcs[index].call(this, result);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
return createComposer;
|
||||
});
|
||||
23
internal/createCurry.js
Normal file
23
internal/createCurry.js
Normal file
@@ -0,0 +1,23 @@
|
||||
define(['./createWrapper', './isIterateeCall'], function(createWrapper, isIterateeCall) {
|
||||
|
||||
/**
|
||||
* Creates a `_.curry` or `_.curryRight` function.
|
||||
*
|
||||
* @private
|
||||
* @param {boolean} flag The curry bit flag.
|
||||
* @returns {Function} Returns the new curry function.
|
||||
*/
|
||||
function createCurry(flag) {
|
||||
function curryFunc(func, arity, guard) {
|
||||
if (guard && isIterateeCall(func, arity, guard)) {
|
||||
arity = null;
|
||||
}
|
||||
var result = createWrapper(func, flag, null, null, null, null, null, arity);
|
||||
result.placeholder = curryFunc.placeholder;
|
||||
return result;
|
||||
}
|
||||
return curryFunc;
|
||||
}
|
||||
|
||||
return createCurry;
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
define(['./baseCallback', './charAtCallback', './extremumBy', '../lang/isArray', './isIterateeCall', '../lang/isString', './toIterable'], function(baseCallback, charAtCallback, extremumBy, isArray, isIterateeCall, isString, toIterable) {
|
||||
|
||||
/**
|
||||
* Creates a function that gets the extremum value of a collection.
|
||||
* Creates a `_.max` or `_.min` function.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} arrayFunc The function to get the extremum value from an array.
|
||||
|
||||
26
internal/createFind.js
Normal file
26
internal/createFind.js
Normal file
@@ -0,0 +1,26 @@
|
||||
define(['./baseCallback', './baseFind', './baseFindIndex', '../lang/isArray'], function(baseCallback, baseFind, baseFindIndex, isArray) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/**
|
||||
* Creates a `_.find` or `_.findLast` function.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} eachFunc The function to iterate over a collection.
|
||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||||
* @returns {Function} Returns the new find function.
|
||||
*/
|
||||
function createFind(eachFunc, fromRight) {
|
||||
return function(collection, predicate, thisArg) {
|
||||
predicate = baseCallback(predicate, thisArg, 3);
|
||||
if (isArray(collection)) {
|
||||
var index = baseFindIndex(collection, predicate, fromRight);
|
||||
return index > -1 ? collection[index] : undefined;
|
||||
}
|
||||
return baseFind(collection, predicate, eachFunc);
|
||||
}
|
||||
}
|
||||
|
||||
return createFind;
|
||||
});
|
||||
21
internal/createFindIndex.js
Normal file
21
internal/createFindIndex.js
Normal file
@@ -0,0 +1,21 @@
|
||||
define(['./baseCallback', './baseFindIndex'], function(baseCallback, baseFindIndex) {
|
||||
|
||||
/**
|
||||
* Creates a `_.findIndex` or `_.findLastIndex` function.
|
||||
*
|
||||
* @private
|
||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||||
* @returns {Function} Returns the new find function.
|
||||
*/
|
||||
function createFindIndex(fromRight) {
|
||||
return function(array, predicate, thisArg) {
|
||||
if (!(array && array.length)) {
|
||||
return -1;
|
||||
}
|
||||
predicate = baseCallback(predicate, thisArg, 3);
|
||||
return baseFindIndex(array, predicate, fromRight);
|
||||
};
|
||||
}
|
||||
|
||||
return createFindIndex;
|
||||
});
|
||||
18
internal/createFindKey.js
Normal file
18
internal/createFindKey.js
Normal file
@@ -0,0 +1,18 @@
|
||||
define(['./baseCallback', './baseFind'], function(baseCallback, baseFind) {
|
||||
|
||||
/**
|
||||
* Creates a `_.findKey` or `_.findLastKey` function.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} objectFunc The function to iterate over an object.
|
||||
* @returns {Function} Returns the new find function.
|
||||
*/
|
||||
function createFindKey(objectFunc) {
|
||||
return function(object, predicate, thisArg) {
|
||||
predicate = baseCallback(predicate, thisArg, 3);
|
||||
return baseFind(object, predicate, objectFunc, true);
|
||||
};
|
||||
}
|
||||
|
||||
return createFindKey;
|
||||
});
|
||||
61
internal/createFlow.js
Normal file
61
internal/createFlow.js
Normal file
@@ -0,0 +1,61 @@
|
||||
define(['./LodashWrapper', './getData', './getFuncName', '../lang/isArray', './isLaziable'], function(LodashWrapper, getData, getFuncName, isArray, isLaziable) {
|
||||
|
||||
/** Used as the `TypeError` message for "Functions" methods. */
|
||||
var FUNC_ERROR_TEXT = 'Expected a function';
|
||||
|
||||
/**
|
||||
* Creates a `_.flow` or `_.flowRight` function.
|
||||
*
|
||||
* @private
|
||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||||
* @returns {Function} Returns the new flow function.
|
||||
*/
|
||||
function createFlow(fromRight) {
|
||||
return function() {
|
||||
var length = arguments.length;
|
||||
if (!length) {
|
||||
return function() { return arguments[0]; };
|
||||
}
|
||||
var wrapper,
|
||||
index = fromRight ? length : -1,
|
||||
leftIndex = 0,
|
||||
funcs = Array(length);
|
||||
|
||||
while ((fromRight ? index-- : ++index < length)) {
|
||||
var func = funcs[leftIndex++] = arguments[index];
|
||||
if (typeof func != 'function') {
|
||||
throw new TypeError(FUNC_ERROR_TEXT);
|
||||
}
|
||||
var funcName = wrapper ? '' : getFuncName(func);
|
||||
wrapper = funcName == 'wrapper' ? new LodashWrapper([]) : wrapper;
|
||||
}
|
||||
index = wrapper ? -1 : length;
|
||||
while (++index < length) {
|
||||
func = funcs[index];
|
||||
funcName = getFuncName(func);
|
||||
|
||||
var data = funcName == 'wrapper' ? getData(func) : null;
|
||||
if (data && isLaziable(data[0])) {
|
||||
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
|
||||
} else {
|
||||
wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func);
|
||||
}
|
||||
}
|
||||
return function() {
|
||||
var args = arguments;
|
||||
if (wrapper && args.length == 1 && isArray(args[0])) {
|
||||
return wrapper.plant(args[0]).value();
|
||||
}
|
||||
var index = 0,
|
||||
result = funcs[index].apply(this, args);
|
||||
|
||||
while (++index < length) {
|
||||
result = funcs[index].call(this, result);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
return createFlow;
|
||||
});
|
||||
20
internal/createForEach.js
Normal file
20
internal/createForEach.js
Normal file
@@ -0,0 +1,20 @@
|
||||
define(['./bindCallback', '../lang/isArray'], function(bindCallback, isArray) {
|
||||
|
||||
/**
|
||||
* Creates a function for `_.forEach` or `_.forEachRight`.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} arrayFunc The function to iterate over an array.
|
||||
* @param {Function} eachFunc The function to iterate over a collection.
|
||||
* @returns {Function} Returns the new each function.
|
||||
*/
|
||||
function createForEach(arrayFunc, eachFunc) {
|
||||
return function(collection, iteratee, thisArg) {
|
||||
return (typeof iteratee == 'function' && typeof thisArg == 'undefined' && isArray(collection))
|
||||
? arrayFunc(collection, iteratee)
|
||||
: eachFunc(collection, bindCallback(iteratee, thisArg, 3));
|
||||
};
|
||||
}
|
||||
|
||||
return createForEach;
|
||||
});
|
||||
20
internal/createForIn.js
Normal file
20
internal/createForIn.js
Normal file
@@ -0,0 +1,20 @@
|
||||
define(['./bindCallback', '../object/keysIn'], function(bindCallback, keysIn) {
|
||||
|
||||
/**
|
||||
* Creates a function for `_.forIn` or `_.forInRight`.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} objectFunc The function to iterate over an object.
|
||||
* @returns {Function} Returns the new each function.
|
||||
*/
|
||||
function createForIn(objectFunc) {
|
||||
return function(object, iteratee, thisArg) {
|
||||
if (typeof iteratee != 'function' || typeof thisArg != 'undefined') {
|
||||
iteratee = bindCallback(iteratee, thisArg, 3);
|
||||
}
|
||||
return objectFunc(object, iteratee, keysIn);
|
||||
};
|
||||
}
|
||||
|
||||
return createForIn;
|
||||
});
|
||||
20
internal/createForOwn.js
Normal file
20
internal/createForOwn.js
Normal file
@@ -0,0 +1,20 @@
|
||||
define(['./bindCallback'], function(bindCallback) {
|
||||
|
||||
/**
|
||||
* Creates a function for `_.forOwn` or `_.forOwnRight`.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} objectFunc The function to iterate over an object.
|
||||
* @returns {Function} Returns the new each function.
|
||||
*/
|
||||
function createForOwn(objectFunc) {
|
||||
return function(object, iteratee, thisArg) {
|
||||
if (typeof iteratee != 'function' || typeof thisArg != 'undefined') {
|
||||
iteratee = bindCallback(iteratee, thisArg, 3);
|
||||
}
|
||||
return objectFunc(object, iteratee);
|
||||
};
|
||||
}
|
||||
|
||||
return createForOwn;
|
||||
});
|
||||
@@ -1,4 +1,7 @@
|
||||
define(['./arrayCopy', './composeArgs', './composeArgsRight', './createCtorWrapper', './reorder', './replaceHolders', './root'], function(arrayCopy, composeArgs, composeArgsRight, createCtorWrapper, reorder, replaceHolders, root) {
|
||||
define(['./arrayCopy', './composeArgs', './composeArgsRight', './createCtorWrapper', './isLaziable', './reorder', './replaceHolders', './root', './setData'], function(arrayCopy, composeArgs, composeArgsRight, createCtorWrapper, isLaziable, reorder, replaceHolders, root, setData) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/** Used to compose bitmasks for wrapper metadata. */
|
||||
var BIND_FLAG = 1,
|
||||
@@ -8,7 +11,7 @@ define(['./arrayCopy', './composeArgs', './composeArgsRight', './createCtorWrapp
|
||||
CURRY_RIGHT_FLAG = 16,
|
||||
PARTIAL_FLAG = 32,
|
||||
PARTIAL_RIGHT_FLAG = 64,
|
||||
ARY_FLAG = 256;
|
||||
ARY_FLAG = 128;
|
||||
|
||||
/* Native method references for those with the same name as other `lodash` methods. */
|
||||
var nativeMax = Math.max;
|
||||
@@ -76,7 +79,12 @@ define(['./arrayCopy', './composeArgs', './composeArgsRight', './createCtorWrapp
|
||||
if (!isCurryBound) {
|
||||
bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);
|
||||
}
|
||||
var result = createHybridWrapper(func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity);
|
||||
var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity],
|
||||
result = createHybridWrapper.apply(undefined, newData);
|
||||
|
||||
if (isLaziable(func)) {
|
||||
setData(result, newData);
|
||||
}
|
||||
result.placeholder = placeholder;
|
||||
return result;
|
||||
}
|
||||
|
||||
18
internal/createPadDir.js
Normal file
18
internal/createPadDir.js
Normal file
@@ -0,0 +1,18 @@
|
||||
define(['./baseToString', './createPadding'], function(baseToString, createPadding) {
|
||||
|
||||
/**
|
||||
* Creates a function for `_.padLeft` or `_.padRight`.
|
||||
*
|
||||
* @private
|
||||
* @param {boolean} [fromRight] Specify padding from the right.
|
||||
* @returns {Function} Returns the new pad function.
|
||||
*/
|
||||
function createPadDir(fromRight) {
|
||||
return function(string, length, chars) {
|
||||
string = baseToString(string);
|
||||
return string && ((fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string));
|
||||
};
|
||||
}
|
||||
|
||||
return createPadDir;
|
||||
});
|
||||
@@ -7,9 +7,8 @@ define(['../string/repeat', './root'], function(repeat, root) {
|
||||
var nativeIsFinite = root.isFinite;
|
||||
|
||||
/**
|
||||
* Creates the pad required for `string` based on the given padding length.
|
||||
* The `chars` string may be truncated if the number of padding characters
|
||||
* exceeds the padding length.
|
||||
* Creates the padding required for `string` based on the given `length`.
|
||||
* The `chars` string is truncated if the number of characters exceeds `length`.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string to create padding for.
|
||||
@@ -17,7 +16,7 @@ define(['../string/repeat', './root'], function(repeat, root) {
|
||||
* @param {string} [chars=' '] The string used as padding.
|
||||
* @returns {string} Returns the pad for `string`.
|
||||
*/
|
||||
function createPad(string, length, chars) {
|
||||
function createPadding(string, length, chars) {
|
||||
var strLength = string.length;
|
||||
length = +length;
|
||||
|
||||
@@ -29,5 +28,5 @@ define(['../string/repeat', './root'], function(repeat, root) {
|
||||
return repeat(chars, ceil(padLength / chars.length)).slice(0, padLength);
|
||||
}
|
||||
|
||||
return createPad;
|
||||
return createPadding;
|
||||
});
|
||||
19
internal/createPartial.js
Normal file
19
internal/createPartial.js
Normal file
@@ -0,0 +1,19 @@
|
||||
define(['./createWrapper', './replaceHolders', '../function/restParam'], function(createWrapper, replaceHolders, restParam) {
|
||||
|
||||
/**
|
||||
* Creates a `_.partial` or `_.partialRight` function.
|
||||
*
|
||||
* @private
|
||||
* @param {boolean} flag The partial bit flag.
|
||||
* @returns {Function} Returns the new partial function.
|
||||
*/
|
||||
function createPartial(flag) {
|
||||
var partialFunc = restParam(function(func, partials) {
|
||||
var holders = replaceHolders(partials, partialFunc.placeholder);
|
||||
return createWrapper(func, flag, null, partials, holders);
|
||||
});
|
||||
return partialFunc;
|
||||
}
|
||||
|
||||
return createPartial;
|
||||
});
|
||||
21
internal/createReduce.js
Normal file
21
internal/createReduce.js
Normal file
@@ -0,0 +1,21 @@
|
||||
define(['./baseCallback', './baseReduce', '../lang/isArray'], function(baseCallback, baseReduce, isArray) {
|
||||
|
||||
/**
|
||||
* Creates a function for `_.reduce` or `_.reduceRight`.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} arrayFunc The function to iterate over an array.
|
||||
* @param {Function} eachFunc The function to iterate over a collection.
|
||||
* @returns {Function} Returns the new each function.
|
||||
*/
|
||||
function createReduce(arrayFunc, eachFunc) {
|
||||
return function(collection, iteratee, accumulator, thisArg) {
|
||||
var initFromArray = arguments.length < 3;
|
||||
return (typeof iteratee == 'function' && typeof thisArg == 'undefined' && isArray(collection))
|
||||
? arrayFunc(collection, iteratee, accumulator, initFromArray)
|
||||
: baseReduce(collection, baseCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc);
|
||||
};
|
||||
}
|
||||
|
||||
return createReduce;
|
||||
});
|
||||
19
internal/createSortedIndex.js
Normal file
19
internal/createSortedIndex.js
Normal file
@@ -0,0 +1,19 @@
|
||||
define(['./baseCallback', './binaryIndex', './binaryIndexBy'], function(baseCallback, binaryIndex, binaryIndexBy) {
|
||||
|
||||
/**
|
||||
* Creates a `_.sortedIndex` or `_.sortedLastIndex` function.
|
||||
*
|
||||
* @private
|
||||
* @param {boolean} [retHighest] Specify returning the highest qualified index.
|
||||
* @returns {Function} Returns the new index function.
|
||||
*/
|
||||
function createSortedIndex(retHighest) {
|
||||
return function(array, value, iteratee, thisArg) {
|
||||
return iteratee == null
|
||||
? binaryIndex(array, value, retHighest)
|
||||
: binaryIndexBy(array, value, baseCallback(iteratee, thisArg, 1), retHighest);
|
||||
};
|
||||
}
|
||||
|
||||
return createSortedIndex;
|
||||
});
|
||||
@@ -57,10 +57,10 @@ define(['./baseSetData', './createBindWrapper', './createHybridWrapper', './crea
|
||||
|
||||
partials = holders = null;
|
||||
}
|
||||
var data = !isBindKey && getData(func),
|
||||
var data = isBindKey ? null : getData(func),
|
||||
newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity];
|
||||
|
||||
if (data && data !== true) {
|
||||
if (data) {
|
||||
mergeData(newData, data);
|
||||
bitmask = newData[1];
|
||||
arity = newData[9];
|
||||
|
||||
@@ -12,18 +12,18 @@ define([], function() {
|
||||
* @param {Array} other The other array to compare.
|
||||
* @param {Function} equalFunc The function to determine equivalents of values.
|
||||
* @param {Function} [customizer] The function to customize comparing arrays.
|
||||
* @param {boolean} [isWhere] Specify performing partial comparisons.
|
||||
* @param {boolean} [isLoose] Specify performing partial comparisons.
|
||||
* @param {Array} [stackA] Tracks traversed `value` objects.
|
||||
* @param {Array} [stackB] Tracks traversed `other` objects.
|
||||
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
||||
*/
|
||||
function equalArrays(array, other, equalFunc, customizer, isWhere, stackA, stackB) {
|
||||
function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
|
||||
var index = -1,
|
||||
arrLength = array.length,
|
||||
othLength = other.length,
|
||||
result = true;
|
||||
|
||||
if (arrLength != othLength && !(isWhere && othLength > arrLength)) {
|
||||
if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
|
||||
return false;
|
||||
}
|
||||
// Deep compare the contents, ignoring non-numeric properties.
|
||||
@@ -33,23 +33,23 @@ define([], function() {
|
||||
|
||||
result = undefined;
|
||||
if (customizer) {
|
||||
result = isWhere
|
||||
result = isLoose
|
||||
? customizer(othValue, arrValue, index)
|
||||
: customizer(arrValue, othValue, index);
|
||||
}
|
||||
if (typeof result == 'undefined') {
|
||||
// Recursively compare arrays (susceptible to call stack limits).
|
||||
if (isWhere) {
|
||||
if (isLoose) {
|
||||
var othIndex = othLength;
|
||||
while (othIndex--) {
|
||||
othValue = other[othIndex];
|
||||
result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isWhere, stackA, stackB);
|
||||
result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isWhere, stackA, stackB);
|
||||
result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,26 +18,26 @@ define(['../object/keys'], function(keys) {
|
||||
* @param {Object} other The other object to compare.
|
||||
* @param {Function} equalFunc The function to determine equivalents of values.
|
||||
* @param {Function} [customizer] The function to customize comparing values.
|
||||
* @param {boolean} [isWhere] Specify performing partial comparisons.
|
||||
* @param {boolean} [isLoose] Specify performing partial comparisons.
|
||||
* @param {Array} [stackA] Tracks traversed `value` objects.
|
||||
* @param {Array} [stackB] Tracks traversed `other` objects.
|
||||
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
||||
*/
|
||||
function equalObjects(object, other, equalFunc, customizer, isWhere, stackA, stackB) {
|
||||
function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
|
||||
var objProps = keys(object),
|
||||
objLength = objProps.length,
|
||||
othProps = keys(other),
|
||||
othLength = othProps.length;
|
||||
|
||||
if (objLength != othLength && !isWhere) {
|
||||
if (objLength != othLength && !isLoose) {
|
||||
return false;
|
||||
}
|
||||
var hasCtor,
|
||||
var skipCtor = isLoose,
|
||||
index = -1;
|
||||
|
||||
while (++index < objLength) {
|
||||
var key = objProps[index],
|
||||
result = hasOwnProperty.call(other, key);
|
||||
result = isLoose ? key in other : hasOwnProperty.call(other, key);
|
||||
|
||||
if (result) {
|
||||
var objValue = object[key],
|
||||
@@ -45,21 +45,21 @@ define(['../object/keys'], function(keys) {
|
||||
|
||||
result = undefined;
|
||||
if (customizer) {
|
||||
result = isWhere
|
||||
result = isLoose
|
||||
? customizer(othValue, objValue, key)
|
||||
: customizer(objValue, othValue, key);
|
||||
}
|
||||
if (typeof result == 'undefined') {
|
||||
// Recursively compare objects (susceptible to call stack limits).
|
||||
result = (objValue && objValue === othValue) || equalFunc(objValue, othValue, customizer, isWhere, stackA, stackB);
|
||||
result = (objValue && objValue === othValue) || equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB);
|
||||
}
|
||||
}
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
hasCtor || (hasCtor = key == 'constructor');
|
||||
skipCtor || (skipCtor = key == 'constructor');
|
||||
}
|
||||
if (!hasCtor) {
|
||||
if (!skipCtor) {
|
||||
var objCtor = object.constructor,
|
||||
othCtor = other.constructor;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ define(['./baseEach'], function(baseEach) {
|
||||
/**
|
||||
* Gets the extremum value of `collection` invoking `iteratee` for each value
|
||||
* in `collection` to generate the criterion by which the value is ranked.
|
||||
* The `iteratee` is invoked with three arguments; (value, index, collection).
|
||||
* The `iteratee` is invoked with three arguments: (value, index, collection).
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object|string} collection The collection to iterate over.
|
||||
|
||||
35
internal/getFuncName.js
Normal file
35
internal/getFuncName.js
Normal file
@@ -0,0 +1,35 @@
|
||||
define(['./baseProperty', '../utility/constant', './realNames', '../support'], function(baseProperty, constant, realNames, support) {
|
||||
|
||||
/**
|
||||
* Gets the name of `func`.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to query.
|
||||
* @returns {string} Returns the function name.
|
||||
*/
|
||||
var getFuncName = (function() {
|
||||
if (!support.funcNames) {
|
||||
return constant('');
|
||||
}
|
||||
if (constant.name == 'constant') {
|
||||
return baseProperty('name');
|
||||
}
|
||||
return function(func) {
|
||||
var result = func.name,
|
||||
array = realNames[result],
|
||||
length = array ? array.length : 0;
|
||||
|
||||
while (length--) {
|
||||
var data = array[length],
|
||||
otherFunc = data.func;
|
||||
|
||||
if (otherFunc == null || otherFunc == func) {
|
||||
return data.name;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}());
|
||||
|
||||
return getFuncName;
|
||||
});
|
||||
@@ -2,7 +2,6 @@ define([], function() {
|
||||
|
||||
/**
|
||||
* Gets the index at which the first occurrence of `NaN` is found in `array`.
|
||||
* If `fromRight` is provided elements of `array` are iterated from right to left.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to search.
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
define(['./baseSetData', '../lang/isNative', '../support'], function(baseSetData, isNative, support) {
|
||||
|
||||
/** Used to detect named functions. */
|
||||
var reFuncName = /^\s*function[ \n\r\t]+\w/;
|
||||
|
||||
/** Used to detect functions containing a `this` reference. */
|
||||
var reThis = /\bthis\b/;
|
||||
|
||||
/** Used to resolve the decompiled source of functions. */
|
||||
var fnToString = Function.prototype.toString;
|
||||
|
||||
/**
|
||||
* Checks if `func` is eligible for `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to check.
|
||||
* @returns {boolean} Returns `true` if `func` is eligible, else `false`.
|
||||
*/
|
||||
function isBindable(func) {
|
||||
var result = !(support.funcNames ? func.name : support.funcDecomp);
|
||||
|
||||
if (!result) {
|
||||
var source = fnToString.call(func);
|
||||
if (!support.funcNames) {
|
||||
result = !reFuncName.test(source);
|
||||
}
|
||||
if (!result) {
|
||||
// Check if `func` references the `this` keyword and store the result.
|
||||
result = reThis.test(source) || isNative(func);
|
||||
baseSetData(func, result);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return isBindable;
|
||||
});
|
||||
@@ -1,9 +1,8 @@
|
||||
define([], function() {
|
||||
|
||||
/**
|
||||
* Used as the maximum length of an array-like value.
|
||||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)
|
||||
* for more details.
|
||||
* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)
|
||||
* of an array-like value.
|
||||
*/
|
||||
var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;
|
||||
|
||||
|
||||
16
internal/isLaziable.js
Normal file
16
internal/isLaziable.js
Normal file
@@ -0,0 +1,16 @@
|
||||
define(['./LazyWrapper', './getFuncName', '../chain/lodash'], function(LazyWrapper, getFuncName, lodash) {
|
||||
|
||||
/**
|
||||
* Checks if `func` has a lazy counterpart.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to check.
|
||||
* @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`.
|
||||
*/
|
||||
function isLaziable(func) {
|
||||
var funcName = getFuncName(func);
|
||||
return !!funcName && func === lodash[funcName] && funcName in LazyWrapper.prototype;
|
||||
}
|
||||
|
||||
return isLaziable;
|
||||
});
|
||||
@@ -1,18 +1,15 @@
|
||||
define([], function() {
|
||||
|
||||
/**
|
||||
* Used as the maximum length of an array-like value.
|
||||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)
|
||||
* for more details.
|
||||
* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)
|
||||
* of an array-like value.
|
||||
*/
|
||||
var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;
|
||||
|
||||
/**
|
||||
* Checks if `value` is a valid array-like length.
|
||||
*
|
||||
* **Note:** This function is based on ES `ToLength`. See the
|
||||
* [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength)
|
||||
* for more details.
|
||||
* **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength).
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
|
||||
@@ -8,7 +8,7 @@ define([], function() {
|
||||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
||||
*/
|
||||
function isObjectLike(value) {
|
||||
return (value && typeof value == 'object') || false;
|
||||
return !!value && typeof value == 'object';
|
||||
}
|
||||
|
||||
return isObjectLike;
|
||||
|
||||
@@ -2,11 +2,10 @@ define(['./arrayCopy', './composeArgs', './composeArgsRight', './replaceHolders'
|
||||
|
||||
/** Used to compose bitmasks for wrapper metadata. */
|
||||
var BIND_FLAG = 1,
|
||||
BIND_KEY_FLAG = 2,
|
||||
CURRY_BOUND_FLAG = 4,
|
||||
CURRY_RIGHT_FLAG = 16,
|
||||
REARG_FLAG = 128,
|
||||
ARY_FLAG = 256;
|
||||
CURRY_FLAG = 8,
|
||||
ARY_FLAG = 128,
|
||||
REARG_FLAG = 256;
|
||||
|
||||
/** Used as the internal argument placeholder. */
|
||||
var PLACEHOLDER = '__lodash_placeholder__';
|
||||
@@ -32,22 +31,13 @@ define(['./arrayCopy', './composeArgs', './composeArgsRight', './replaceHolders'
|
||||
function mergeData(data, source) {
|
||||
var bitmask = data[1],
|
||||
srcBitmask = source[1],
|
||||
newBitmask = bitmask | srcBitmask;
|
||||
newBitmask = bitmask | srcBitmask,
|
||||
isCommon = newBitmask < ARY_FLAG;
|
||||
|
||||
var arityFlags = ARY_FLAG | REARG_FLAG,
|
||||
bindFlags = BIND_FLAG | BIND_KEY_FLAG,
|
||||
comboFlags = arityFlags | bindFlags | CURRY_BOUND_FLAG | CURRY_RIGHT_FLAG;
|
||||
|
||||
var isAry = bitmask & ARY_FLAG && !(srcBitmask & ARY_FLAG),
|
||||
isRearg = bitmask & REARG_FLAG && !(srcBitmask & REARG_FLAG),
|
||||
argPos = (isRearg ? data : source)[7],
|
||||
ary = (isAry ? data : source)[8];
|
||||
|
||||
var isCommon = !(bitmask >= REARG_FLAG && srcBitmask > bindFlags) &&
|
||||
!(bitmask > bindFlags && srcBitmask >= REARG_FLAG);
|
||||
|
||||
var isCombo = (newBitmask >= arityFlags && newBitmask <= comboFlags) &&
|
||||
(bitmask < REARG_FLAG || ((isRearg || isAry) && argPos.length <= ary));
|
||||
var isCombo =
|
||||
(srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) ||
|
||||
(srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) ||
|
||||
(srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG);
|
||||
|
||||
// Exit early if metadata can't be merged.
|
||||
if (!(isCommon || isCombo)) {
|
||||
|
||||
7
internal/realNames.js
Normal file
7
internal/realNames.js
Normal file
@@ -0,0 +1,7 @@
|
||||
define([], function() {
|
||||
|
||||
/** Used to lookup unminified function names. */
|
||||
var realNames = {};
|
||||
|
||||
return realNames;
|
||||
});
|
||||
@@ -15,8 +15,11 @@ define([], function() {
|
||||
/** Detect free variable `global` from Node.js. */
|
||||
var freeGlobal = freeExports && freeModule && typeof global == 'object' && global;
|
||||
|
||||
/** Detect free variable `self`. */
|
||||
var freeSelf = objectTypes[typeof self] && self && self.Object && self;
|
||||
|
||||
/** Detect free variable `window`. */
|
||||
var freeWindow = objectTypes[typeof window] && window;
|
||||
var freeWindow = objectTypes[typeof window] && window && window.Object && window;
|
||||
|
||||
/**
|
||||
* Used as a reference to the global object.
|
||||
@@ -24,7 +27,7 @@ define([], function() {
|
||||
* The `this` value is used if it is the global object to avoid Greasemonkey's
|
||||
* restricted `window` object, otherwise the `window` object is used.
|
||||
*/
|
||||
var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || this;
|
||||
var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;
|
||||
|
||||
return root;
|
||||
});
|
||||
|
||||
@@ -10,9 +10,8 @@ define(['./baseForIn', './isObjectLike'], function(baseForIn, isObjectLike) {
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Used to resolve the `toStringTag` of values.
|
||||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring)
|
||||
* for more details.
|
||||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objToString = objectProto.toString;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user