mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-13 20:37:48 +00:00
Rebuild dist.
This commit is contained in:
140
dist/lodash.compat.js
vendored
140
dist/lodash.compat.js
vendored
@@ -163,16 +163,16 @@
|
||||
|
||||
/** Used to identify object classifications that `_.clone` supports */
|
||||
var cloneableClasses = {};
|
||||
cloneableClasses[argsClass] =
|
||||
cloneableClasses[arrayClass] = cloneableClasses[arrayBufferClass] =
|
||||
cloneableClasses[boolClass] = cloneableClasses[dateClass] =
|
||||
cloneableClasses[errorClass] = cloneableClasses[float32Class] =
|
||||
cloneableClasses[argsClass] = cloneableClasses[arrayClass] =
|
||||
cloneableClasses[arrayBufferClass] = cloneableClasses[boolClass] =
|
||||
cloneableClasses[dateClass] = cloneableClasses[float32Class] =
|
||||
cloneableClasses[float64Class] = cloneableClasses[int8Class] =
|
||||
cloneableClasses[int16Class] = cloneableClasses[int32Class] =
|
||||
cloneableClasses[numberClass] = cloneableClasses[objectClass] =
|
||||
cloneableClasses[regexpClass] = cloneableClasses[stringClass] =
|
||||
cloneableClasses[uint8Class] = cloneableClasses[uint8ClampedClass] =
|
||||
cloneableClasses[uint16Class] = cloneableClasses[uint32Class] = true;
|
||||
cloneableClasses[errorClass] =
|
||||
cloneableClasses[funcClass] = cloneableClasses[mapClass] =
|
||||
cloneableClasses[setClass] = cloneableClasses[weakMapClass] = false;
|
||||
|
||||
@@ -713,17 +713,14 @@
|
||||
nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true };
|
||||
nonEnumProps[objectClass] = { 'constructor': true };
|
||||
|
||||
(function() {
|
||||
var length = shadowedProps.length;
|
||||
while (length--) {
|
||||
var key = shadowedProps[length];
|
||||
for (var className in nonEnumProps) {
|
||||
if (hasOwnProperty.call(nonEnumProps, className) && !hasOwnProperty.call(nonEnumProps[className], key)) {
|
||||
nonEnumProps[className][key] = false;
|
||||
}
|
||||
arrayEach(shadowedProps, function(key) {
|
||||
for (var className in nonEnumProps) {
|
||||
if (hasOwnProperty.call(nonEnumProps, className)) {
|
||||
var props = nonEnumProps[className];
|
||||
props[key] = hasOwnProperty.call(props, key);
|
||||
}
|
||||
}
|
||||
}());
|
||||
});
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
@@ -1238,9 +1235,6 @@
|
||||
case dateClass:
|
||||
return new Ctor(+value);
|
||||
|
||||
case errorClass:
|
||||
return new Ctor(value.message);
|
||||
|
||||
case float32Class: case float64Class:
|
||||
case int8Class: case int16Class: case int32Class:
|
||||
case uint8Class: case uint8ClampedClass: case uint16Class: case uint32Class:
|
||||
@@ -1465,7 +1459,7 @@
|
||||
* of values to exclude.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to process.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {Array} [values] The array of values to exclude.
|
||||
* @returns {Array} Returns the new array of filtered values.
|
||||
*/
|
||||
@@ -1602,6 +1596,7 @@
|
||||
function baseFlatten(array, isShallow, isStrict, fromIndex) {
|
||||
var index = (fromIndex || 0) - 1,
|
||||
length = array ? array.length : 0,
|
||||
resIndex = 0,
|
||||
result = [];
|
||||
|
||||
while (++index < length) {
|
||||
@@ -1614,15 +1609,14 @@
|
||||
value = baseFlatten(value, isShallow, isStrict);
|
||||
}
|
||||
var valIndex = -1,
|
||||
valLength = value.length,
|
||||
resIndex = result.length;
|
||||
valLength = value.length;
|
||||
|
||||
result.length += valLength;
|
||||
while (++valIndex < valLength) {
|
||||
result[resIndex++] = value[valIndex];
|
||||
}
|
||||
} else if (!isStrict) {
|
||||
result.push(value);
|
||||
result[resIndex++] = value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -1792,10 +1786,6 @@
|
||||
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal
|
||||
return +value == +other;
|
||||
|
||||
case errorClass:
|
||||
// check properties instead of coercing to strings to support IE < 8
|
||||
return value.name === other.name && value.message === other.message;
|
||||
|
||||
case numberClass:
|
||||
// treat `NaN` vs. `NaN` as equal
|
||||
return (value != +value)
|
||||
@@ -1805,18 +1795,20 @@
|
||||
|
||||
case regexpClass:
|
||||
case stringClass:
|
||||
// coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
|
||||
// treat string primitives and object instances as equal
|
||||
// coerce regexes to strings (http://es5.github.io/#x15.10.6.4) and
|
||||
// treat strings primitives and string objects as equal
|
||||
return value == String(other);
|
||||
}
|
||||
var isArr = arrayLikeClasses[valClass],
|
||||
isErr = valClass == errorClass;
|
||||
|
||||
if (!support.argsClass) {
|
||||
valIsArg = isArguments(value);
|
||||
othIsArg = isArguments(other);
|
||||
}
|
||||
var isArr = arrayLikeClasses[valClass];
|
||||
if (!isArr) {
|
||||
// exit for functions and DOM nodes
|
||||
if (valClass != objectClass || (!support.nodeClass && (isNode(value) || isNode(other)))) {
|
||||
// exit for things like functions and DOM nodes
|
||||
if (!(isErr || valClass == objectClass) || (!support.nodeClass && (isNode(value) || isNode(other)))) {
|
||||
return false;
|
||||
}
|
||||
// unwrap any `lodash` wrapped values
|
||||
@@ -1837,6 +1829,10 @@
|
||||
var valCtor = valIsArg ? Object : value.constructor,
|
||||
othCtor = othIsArg ? Object : other.constructor;
|
||||
|
||||
// error objects of different types are not equal
|
||||
if (isErr && valCtor.prototype.name != othCtor.prototype.name) {
|
||||
return false;
|
||||
}
|
||||
// non `Object` object instances with different constructors are not equal
|
||||
if (valCtor != othCtor &&
|
||||
!(isFunction(valCtor) && valCtor instanceof valCtor && isFunction(othCtor) && othCtor instanceof othCtor) &&
|
||||
@@ -1896,8 +1892,8 @@
|
||||
}
|
||||
}
|
||||
else {
|
||||
var valProps = keys(value),
|
||||
othProps = keys(other);
|
||||
var valProps = isErr ? ['message', 'name'] : keys(value),
|
||||
othProps = isErr ? valProps : keys(other);
|
||||
|
||||
if (valIsArg) {
|
||||
valProps.push('length');
|
||||
@@ -1911,7 +1907,8 @@
|
||||
if (result || isWhere) {
|
||||
while (++index < length) {
|
||||
var key = valProps[index];
|
||||
result = hasOwnProperty.call(other, key);
|
||||
result = isErr || hasOwnProperty.call(other, key);
|
||||
|
||||
if (result) {
|
||||
valValue = value[key];
|
||||
othValue = other[key];
|
||||
@@ -2095,7 +2092,7 @@
|
||||
* and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to process.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted.
|
||||
* @param {Function} [callback] The function called per iteration.
|
||||
* @returns {Array} Returns the new duplicate-value-free array.
|
||||
@@ -2308,7 +2305,7 @@
|
||||
var args = arguments,
|
||||
length = args.length;
|
||||
|
||||
if (!object || length < 2) {
|
||||
if (object == null || length < 2) {
|
||||
return object;
|
||||
}
|
||||
// enables use as a callback for functions like `_.reduce`
|
||||
@@ -2649,6 +2646,37 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Creates an array of elements split into groups the length of `chunkSize`.
|
||||
* If `collection` can't be split evenly, the final chunk will be the remaining
|
||||
* elements.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Arrays
|
||||
* @param {Array} array The array to process.
|
||||
* @param {numer} [chunkSize=1] The size of each chunk.
|
||||
* @returns {Array} Returns the new array containing chunks.
|
||||
* @example
|
||||
*
|
||||
* _.chunk(['a', 'b', 'c', 'd'], 2);
|
||||
* // => [['a', 'b'], ['c', 'd']]
|
||||
*
|
||||
* _.chunk(['a', 'b', 'c', 'd'], 3);
|
||||
* // => [['a', 'b', 'c'], ['d']]
|
||||
*/
|
||||
function chunk(array, chunkSize) {
|
||||
var index = 0,
|
||||
length = array ? array.length : 0,
|
||||
result = [];
|
||||
|
||||
chunkSize = nativeMax(+chunkSize || 1, 1);
|
||||
while (index < length) {
|
||||
result.push(slice(array, index, (index += chunkSize)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array with all falsey values removed. The values `false`, `null`,
|
||||
* `0`, `""`, `undefined`, and `NaN` are all falsey.
|
||||
@@ -2685,7 +2713,7 @@
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Arrays
|
||||
* @param {Array} array The array to process.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {...Array} [values] The arrays of values to exclude.
|
||||
* @returns {Array} Returns the new array of filtered values.
|
||||
* @example
|
||||
@@ -3680,7 +3708,7 @@
|
||||
* @memberOf _
|
||||
* @alias unique
|
||||
* @category Arrays
|
||||
* @param {Array} array The array to process.
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted.
|
||||
* @param {Function|Object|string} [callback] The function called per iteration.
|
||||
* If a property name or object is provided it is used to create a "_.pluck"
|
||||
@@ -3806,8 +3834,8 @@
|
||||
function zip() {
|
||||
var array = arguments.length > 1 ? arguments : arguments[0],
|
||||
index = -1,
|
||||
length = array ? max(pluck(array, 'length')) : 0,
|
||||
result = Array(length < 0 ? 0 : length);
|
||||
length = isObject(length = max(array, 'length')) && length.length || 0,
|
||||
result = Array(length);
|
||||
|
||||
while (++index < length) {
|
||||
result[index] = pluck(array, index);
|
||||
@@ -5515,7 +5543,7 @@
|
||||
trailing = false;
|
||||
} else if (isObject(options)) {
|
||||
leading = options.leading;
|
||||
maxWait = 'maxWait' in options && nativeMax(wait, +options.maxWait || 0);
|
||||
maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait);
|
||||
trailing = 'trailing' in options ? options.trailing : trailing;
|
||||
}
|
||||
|
||||
@@ -5790,9 +5818,9 @@
|
||||
* @example
|
||||
*
|
||||
* var greet = function(greeting, name) { return greeting + ' ' + name; };
|
||||
* var hi = _.partial(greet, 'hi');
|
||||
* hi('fred');
|
||||
* // => 'hi fred'
|
||||
* var sayHelloTo = _.partial(greet, 'hello');
|
||||
* sayHelloTo('fred');
|
||||
* // => 'hello fred'
|
||||
*/
|
||||
function partial(func) {
|
||||
if (func) {
|
||||
@@ -5819,6 +5847,12 @@
|
||||
* @returns {Function} Returns the new partially applied function.
|
||||
* @example
|
||||
*
|
||||
* var greet = function(greeting, name) { return greeting + ' ' + name; };
|
||||
* var greetFred = _.partialRight(greet, 'fred');
|
||||
* greetFred('hello');
|
||||
* // => 'hello fred'
|
||||
*
|
||||
* // create a deep `_.defaults`
|
||||
* var defaultsDeep = _.partialRight(_.merge, function deep(value, other) {
|
||||
* return _.merge(value, other, deep);
|
||||
* });
|
||||
@@ -6117,7 +6151,7 @@
|
||||
* // => { 'name': 'barney', 'age': 36, 'employer': 'slate' }
|
||||
*/
|
||||
function defaults(object) {
|
||||
if (!object) {
|
||||
if (object == null) {
|
||||
return object;
|
||||
}
|
||||
var args = slice(arguments);
|
||||
@@ -6539,7 +6573,7 @@
|
||||
/**
|
||||
* Checks if a collection is empty. A value is considered empty unless it is
|
||||
* an array, array-like object, or string with a length greater than `0` or
|
||||
* an object with own properties.
|
||||
* an object with own enumerable properties.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -7173,13 +7207,8 @@
|
||||
if (typeof predicate == 'function') {
|
||||
return basePick(object, negate(lodash.createCallback(predicate, thisArg, 3)));
|
||||
}
|
||||
var omitProps = baseFlatten(arguments, true, false, 1),
|
||||
length = omitProps.length;
|
||||
|
||||
while (length--) {
|
||||
omitProps[length] = String(omitProps[length]);
|
||||
}
|
||||
return basePick(object, baseDifference(keysIn(object), omitProps));
|
||||
var omitProps = baseFlatten(arguments, true, false, 1);
|
||||
return basePick(object, baseDifference(keysIn(object), arrayMap(omitProps, String)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -7800,7 +7829,7 @@
|
||||
string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
|
||||
interpolateValue || (interpolateValue = esTemplateValue);
|
||||
|
||||
// escape characters that cannot be included in string literals
|
||||
// escape characters that can't be included in string literals
|
||||
source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
|
||||
|
||||
// replace delimiters with snippets
|
||||
@@ -8176,17 +8205,17 @@
|
||||
// property containing a primitive value
|
||||
if (propsLength == 1 && value === value && !isObject(value)) {
|
||||
return function(object) {
|
||||
if (!(object && hasOwnProperty.call(object, key))) {
|
||||
if (object == null) {
|
||||
return false;
|
||||
}
|
||||
// treat `-0` vs. `+0` as not equal
|
||||
var other = object[key];
|
||||
return value === other && (value !== 0 || (1 / value == 1 / other));
|
||||
return value === other && (value !== 0 || (1 / value == 1 / other)) && hasOwnProperty.call(object, key);
|
||||
};
|
||||
}
|
||||
return function(object) {
|
||||
var length = propsLength;
|
||||
if (length && !object) {
|
||||
if (length && object == null) {
|
||||
return false;
|
||||
}
|
||||
while (length--) {
|
||||
@@ -8612,6 +8641,7 @@
|
||||
lodash.bindAll = bindAll;
|
||||
lodash.bindKey = bindKey;
|
||||
lodash.chain = chain;
|
||||
lodash.chunk = chunk;
|
||||
lodash.compact = compact;
|
||||
lodash.compose = compose;
|
||||
lodash.constant = constant;
|
||||
|
||||
Reference in New Issue
Block a user