mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Rebuild dist.
This commit is contained in:
166
dist/lodash.compat.js
vendored
166
dist/lodash.compat.js
vendored
@@ -104,10 +104,11 @@
|
||||
|
||||
/** Used to assign default `context` object properties */
|
||||
var contextProps = [
|
||||
'Array', 'ArrayBuffer', 'Boolean', 'Date', 'Error', 'Float64Array', 'Function',
|
||||
'Math', 'Number', 'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout',
|
||||
'document', 'isFinite', 'isNaN','parseInt', 'setTimeout', 'TypeError',
|
||||
'Uint8Array', 'window', 'WinRTError'
|
||||
'Array', 'ArrayBuffer', 'Boolean', 'Date', 'Error', 'Float32Array', 'Float64Array',
|
||||
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number', 'Object',
|
||||
'RegExp', 'Set', 'String', '_', 'clearTimeout', 'document', 'isFinite', 'isNaN',
|
||||
'parseInt', 'setTimeout', 'TypeError', 'Uint8Array', 'Uint8ClampedArray',
|
||||
'Uint16Array', 'Uint32Array', 'window', 'WinRTError'
|
||||
];
|
||||
|
||||
/** Used to fix the JScript `[[DontEnum]]` bug */
|
||||
@@ -654,7 +655,7 @@
|
||||
|
||||
/** Native method shortcuts */
|
||||
var ArrayBuffer = isNative(ArrayBuffer = context.ArrayBuffer) && ArrayBuffer,
|
||||
bufferSlice = isNative(bufferSlice = ArrayBuffer && (new ArrayBuffer).slice) && bufferSlice,
|
||||
bufferSlice = isNative(bufferSlice = ArrayBuffer && new ArrayBuffer(0).slice) && bufferSlice,
|
||||
ceil = Math.ceil,
|
||||
clearTimeout = context.clearTimeout,
|
||||
Float64Array = isNative(Float64Array = context.Float64Array) && Float64Array,
|
||||
@@ -693,6 +694,18 @@
|
||||
nativeParseInt = context.parseInt,
|
||||
nativeRandom = Math.random;
|
||||
|
||||
/** Used to lookup a built-in constructor by [[Class]] */
|
||||
var ctorByClass = {};
|
||||
ctorByClass[float32Class] = context.Float32Array;
|
||||
ctorByClass[float64Class] = context.Float64Array;
|
||||
ctorByClass[int8Class] = context.Int8Array;
|
||||
ctorByClass[int16Class] = context.Int16Array;
|
||||
ctorByClass[int32Class] = context.Int32Array;
|
||||
ctorByClass[uint8Class] = context.Uint8Array;
|
||||
ctorByClass[uint8ClampedClass] = context.Uint8ClampedArray;
|
||||
ctorByClass[uint16Class] = context.Uint16Array;
|
||||
ctorByClass[uint32Class] = context.Uint32Array;
|
||||
|
||||
/** Used to avoid iterating over non-enumerable properties in IE < 9 */
|
||||
var nonEnumProps = {};
|
||||
nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
|
||||
@@ -827,15 +840,6 @@
|
||||
*/
|
||||
support.argsClass = toString.call(arguments) == argsClass;
|
||||
|
||||
/**
|
||||
* Detect if `arguments` objects are `Object` objects
|
||||
* (all but Narwhal and Opera < 10.5).
|
||||
*
|
||||
* @memberOf _.support
|
||||
* @type boolean
|
||||
*/
|
||||
support.argsObject = arguments.constructor == Object && !(arguments instanceof Array);
|
||||
|
||||
/**
|
||||
* Detect if `name` or `message` properties of `Error.prototype` are
|
||||
* enumerable by default (IE < 9, Safari < 5.1).
|
||||
@@ -1240,7 +1244,11 @@
|
||||
case float32Class: case float64Class:
|
||||
case int8Class: case int16Class: case int32Class:
|
||||
case uint8Class: case uint8ClampedClass: case uint16Class: case uint32Class:
|
||||
return value.subarray(0);
|
||||
// Safari 5 mobile incorrectly has `Object` as the constructor
|
||||
if (Ctor instanceof Ctor) {
|
||||
Ctor = ctorByClass[className];
|
||||
}
|
||||
return new Ctor(cloneBuffer(value.buffer));
|
||||
|
||||
case numberClass:
|
||||
case stringClass:
|
||||
@@ -1266,13 +1274,16 @@
|
||||
return stackB[length];
|
||||
}
|
||||
}
|
||||
result = isArr ? Ctor(value.length) : Ctor();
|
||||
result = isArr ? Ctor(value.length) : new Ctor;
|
||||
}
|
||||
else {
|
||||
result = isArr ? slice(value) : baseAssign({}, value);
|
||||
}
|
||||
if (className == argsClass || (!support.argsClass && isArguments(value))) {
|
||||
result.length = value.length;
|
||||
}
|
||||
// add array properties assigned by `RegExp#exec`
|
||||
if (isArr) {
|
||||
else if (isArr) {
|
||||
if (hasOwnProperty.call(value, 'index')) {
|
||||
result.index = value.index;
|
||||
}
|
||||
@@ -1340,8 +1351,7 @@
|
||||
if (typeof func != 'function') {
|
||||
return identity;
|
||||
}
|
||||
// exit early for no `thisArg` or already bound by `Function#bind`
|
||||
if (typeof thisArg == 'undefined' || !('prototype' in func)) {
|
||||
if (typeof thisArg == 'undefined') {
|
||||
return func;
|
||||
}
|
||||
var data = func[expando];
|
||||
@@ -1357,7 +1367,7 @@
|
||||
}
|
||||
if (!data) {
|
||||
// checks if `func` references the `this` keyword and stores the result
|
||||
data = reThis.test(source);
|
||||
data = reThis.test(source) || isNative(func);
|
||||
setData(func, data);
|
||||
}
|
||||
}
|
||||
@@ -1762,8 +1772,8 @@
|
||||
return false;
|
||||
}
|
||||
var valClass = toString.call(value),
|
||||
othClass = toString.call(other),
|
||||
valIsArg = valClass == argsClass,
|
||||
othClass = toString.call(other),
|
||||
othIsArg = othClass == argsClass;
|
||||
|
||||
if (valIsArg) {
|
||||
@@ -1782,6 +1792,10 @@
|
||||
// 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)
|
||||
@@ -1789,14 +1803,16 @@
|
||||
// but treat `-0` vs. `+0` as not equal
|
||||
: (value == 0 ? (1 / value == 1 / other) : value == +other);
|
||||
|
||||
case errorClass:
|
||||
case regexpClass:
|
||||
case stringClass:
|
||||
// coerce errors (http://es5.github.io/#x15.11.4.4)
|
||||
// and regexes (http://es5.github.io/#x15.10.6.4) to strings
|
||||
// treat string primitives and their corresponding object instances as equal
|
||||
// coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
|
||||
// treat string primitives and object instances as equal
|
||||
return value == String(other);
|
||||
}
|
||||
if (!support.argsClass) {
|
||||
valIsArg = isArguments(value);
|
||||
othIsArg = isArguments(other);
|
||||
}
|
||||
var isArr = arrayLikeClasses[valClass];
|
||||
if (!isArr) {
|
||||
// exit for functions and DOM nodes
|
||||
@@ -1810,10 +1826,6 @@
|
||||
if (valWrapped || othWrapped) {
|
||||
return baseIsEqual(valWrapped ? value.__wrapped__ : value, othWrapped ? other.__wrapped__ : other, callback, isWhere, stackA, stackB);
|
||||
}
|
||||
if (!support.argsObject) {
|
||||
valIsArg = isArguments(value);
|
||||
othIsArg = isArguments(other);
|
||||
}
|
||||
var hasValCtor = !valIsArg && hasOwnProperty.call(value, 'constructor'),
|
||||
hasOthCtor = !othIsArg && hasOwnProperty.call(other, 'constructor');
|
||||
|
||||
@@ -1846,7 +1858,7 @@
|
||||
return stackB[length] == other;
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
var index = -1;
|
||||
|
||||
// add `value` and `other` to the stack of traversed objects
|
||||
stackA.push(value);
|
||||
@@ -1854,32 +1866,28 @@
|
||||
|
||||
// recursively compare objects and arrays (susceptible to call stack limits)
|
||||
if (isArr) {
|
||||
// compare lengths to determine if a deep comparison is necessary
|
||||
var othLength = other.length;
|
||||
length = value.length;
|
||||
result = othLength == length;
|
||||
|
||||
if (result || isWhere) {
|
||||
var othIndex = -1;
|
||||
result = length == othLength;
|
||||
|
||||
if (result || (isWhere && othLength > length)) {
|
||||
// deep compare the contents, ignoring non-numeric properties
|
||||
while (++othIndex < othLength) {
|
||||
var othValue = other[othIndex];
|
||||
|
||||
while (++index < length) {
|
||||
var valValue = value[index];
|
||||
if (isWhere) {
|
||||
var index = -1;
|
||||
while (++index < length) {
|
||||
result = baseIsEqual(value[index], othValue, callback, isWhere, stackA, stackB);
|
||||
var othIndex = othLength;
|
||||
while (othIndex--) {
|
||||
result = baseIsEqual(valValue, other[othIndex], callback, isWhere, stackA, stackB);
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var valValue = value[othIndex];
|
||||
result = callback ? callback(valValue, othValue, othIndex) : undefined;
|
||||
result = typeof result == 'undefined'
|
||||
? baseIsEqual(valValue, othValue, callback, isWhere, stackA, stackB)
|
||||
: !!result;
|
||||
var othValue = other[index];
|
||||
result = callback ? callback(valValue, othValue, index) : undefined;
|
||||
if (typeof result == 'undefined') {
|
||||
result = baseIsEqual(valValue, othValue, callback, isWhere, stackA, stackB);
|
||||
}
|
||||
}
|
||||
if (!result) {
|
||||
break;
|
||||
@@ -1888,42 +1896,40 @@
|
||||
}
|
||||
}
|
||||
else {
|
||||
var size = 0;
|
||||
var valProps = keys(value),
|
||||
othProps = keys(other);
|
||||
|
||||
// deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
|
||||
// which, in this case, is more costly
|
||||
baseForIn(other, function(othValue, key, other) {
|
||||
if (hasOwnProperty.call(other, key)) {
|
||||
result = false;
|
||||
// count the number of properties
|
||||
size++;
|
||||
// deep compare each property value
|
||||
if (hasOwnProperty.call(value, key)) {
|
||||
var valValue = value[key];
|
||||
if (valIsArg) {
|
||||
valProps.push('length');
|
||||
}
|
||||
if (othIsArg) {
|
||||
othProps.push('length');
|
||||
}
|
||||
length = valProps.length;
|
||||
result = length == othProps.length;
|
||||
|
||||
if (result || isWhere) {
|
||||
while (++index < length) {
|
||||
var key = valProps[index];
|
||||
result = hasOwnProperty.call(other, key);
|
||||
if (result) {
|
||||
valValue = value[key];
|
||||
othValue = other[key];
|
||||
result = callback ? callback(valValue, othValue, key) : undefined;
|
||||
result = typeof result == 'undefined'
|
||||
? baseIsEqual(valValue, othValue, callback, isWhere, stackA, stackB)
|
||||
: !!result;
|
||||
if (typeof result == 'undefined') {
|
||||
result = baseIsEqual(valValue, othValue, callback, isWhere, stackA, stackB);
|
||||
}
|
||||
}
|
||||
if (!result) {
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
});
|
||||
|
||||
if (result && !isWhere) {
|
||||
// ensure both objects have the same number of properties
|
||||
baseForIn(value, function(valValue, key, value) {
|
||||
if (hasOwnProperty.call(value, key)) {
|
||||
// `size` will be `-1` if `value` has more properties than `other`
|
||||
result = --size > -1;
|
||||
return result;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
stackA.pop();
|
||||
stackB.pop();
|
||||
|
||||
return result;
|
||||
return !!result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5063,8 +5069,8 @@
|
||||
* @category Collections
|
||||
* @param {Array|Object|string} collection The collection to iterate over.
|
||||
* @param {Array|Function|Object|string} [callback=identity] The function
|
||||
* called per iteration. If a property name or object is provided it is
|
||||
* used to create a "_.pluck" or "_.where" style callback respectively.
|
||||
* called per iteration. If property name(s) or an object is provided it
|
||||
* is used to create a "_.pluck" or "_.where" style callback respectively.
|
||||
* @param {*} [thisArg] The `this` binding of `callback`.
|
||||
* @returns {Array} Returns the new sorted array.
|
||||
* @example
|
||||
@@ -8107,7 +8113,7 @@
|
||||
var type = typeof func,
|
||||
isFunc = type == 'function';
|
||||
|
||||
if (isFunc && (typeof thisArg == 'undefined' || !('prototype' in func))) {
|
||||
if (isFunc && typeof thisArg == 'undefined') {
|
||||
return func;
|
||||
}
|
||||
if (isFunc || func == null) {
|
||||
@@ -8186,7 +8192,7 @@
|
||||
while (length--) {
|
||||
var key = props[length];
|
||||
if (!(hasOwnProperty.call(object, key) &&
|
||||
baseIsEqual(object[key], source[key], null, true))) {
|
||||
baseIsEqual(source[key], object[key], null, true))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -8892,9 +8898,9 @@
|
||||
|
||||
// some AMD build optimizers like r.js check for condition patterns like the following:
|
||||
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
|
||||
// Expose Lo-Dash to the global object even when an AMD loader is present in
|
||||
// case Lo-Dash is loaded with a RequireJS shim config.
|
||||
// See http://requirejs.org/docs/api.html#config-shim
|
||||
// Expose Lo-Dash to the global object when an AMD loader is present to avoid
|
||||
// errors in cases where Lo-Dash is loaded by a script tag and not intended
|
||||
// as an AMD module. See http://requirejs.org/docs/errors.html#mismatch
|
||||
root._ = _;
|
||||
|
||||
// define as an anonymous module so, through path mapping, it can be
|
||||
|
||||
Reference in New Issue
Block a user