mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 02:17:48 +00:00
Bump to v3.6.0.
This commit is contained in:
@@ -7,12 +7,12 @@ define(['../internal/baseClone', '../internal/bindCallback', '../internal/isIter
|
||||
* cloning is handled by the method instead. The `customizer` is bound to
|
||||
* `thisArg` and invoked with two argument; (value [, index|key, object]).
|
||||
*
|
||||
* **Note:** This method is loosely based on the structured clone algorithm.
|
||||
* **Note:** This method is loosely based on the
|
||||
* [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
|
||||
* The enumerable properties of `arguments` objects and objects created by
|
||||
* constructors other than `Object` are cloned to plain `Object` objects. An
|
||||
* empty object is returned for uncloneable values such as functions, DOM nodes,
|
||||
* Maps, Sets, and WeakMaps. See the [HTML5 specification](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm)
|
||||
* for more details.
|
||||
* Maps, Sets, and WeakMaps.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -6,12 +6,12 @@ define(['../internal/baseClone', '../internal/bindCallback'], function(baseClone
|
||||
* is handled by the method instead. The `customizer` is bound to `thisArg`
|
||||
* and invoked with two argument; (value [, index|key, object]).
|
||||
*
|
||||
* **Note:** This method is loosely based on the structured clone algorithm.
|
||||
* **Note:** This method is loosely based on the
|
||||
* [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
|
||||
* The enumerable properties of `arguments` objects and objects created by
|
||||
* constructors other than `Object` are cloned to plain `Object` objects. An
|
||||
* empty object is returned for uncloneable values such as functions, DOM nodes,
|
||||
* Maps, Sets, and WeakMaps. See the [HTML5 specification](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm)
|
||||
* for more details.
|
||||
* Maps, Sets, and WeakMaps.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -10,9 +10,8 @@ define(['../internal/isLength', '../internal/isObjectLike'], function(isLength,
|
||||
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;
|
||||
|
||||
@@ -34,7 +33,7 @@ define(['../internal/isLength', '../internal/isObjectLike'], function(isLength,
|
||||
*/
|
||||
function isArguments(value) {
|
||||
var length = isObjectLike(value) ? value.length : undefined;
|
||||
return (isLength(length) && objToString.call(value) == argsTag) || false;
|
||||
return isLength(length) && objToString.call(value) == argsTag;
|
||||
}
|
||||
|
||||
return isArguments;
|
||||
|
||||
@@ -7,9 +7,8 @@ define(['../internal/isLength', './isNative', '../internal/isObjectLike'], funct
|
||||
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;
|
||||
|
||||
@@ -33,7 +32,7 @@ define(['../internal/isLength', './isNative', '../internal/isObjectLike'], funct
|
||||
* // => false
|
||||
*/
|
||||
var isArray = nativeIsArray || function(value) {
|
||||
return (isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag) || false;
|
||||
return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
|
||||
};
|
||||
|
||||
return isArray;
|
||||
|
||||
@@ -7,9 +7,8 @@ define(['../internal/isObjectLike'], function(isObjectLike) {
|
||||
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;
|
||||
|
||||
@@ -30,7 +29,7 @@ define(['../internal/isObjectLike'], function(isObjectLike) {
|
||||
* // => false
|
||||
*/
|
||||
function isBoolean(value) {
|
||||
return (value === true || value === false || isObjectLike(value) && objToString.call(value) == boolTag) || false;
|
||||
return value === true || value === false || (isObjectLike(value) && objToString.call(value) == boolTag);
|
||||
}
|
||||
|
||||
return isBoolean;
|
||||
|
||||
@@ -7,9 +7,8 @@ define(['../internal/isObjectLike'], function(isObjectLike) {
|
||||
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;
|
||||
|
||||
@@ -30,7 +29,7 @@ define(['../internal/isObjectLike'], function(isObjectLike) {
|
||||
* // => false
|
||||
*/
|
||||
function isDate(value) {
|
||||
return (isObjectLike(value) && objToString.call(value) == dateTag) || false;
|
||||
return isObjectLike(value) && objToString.call(value) == dateTag;
|
||||
}
|
||||
|
||||
return isDate;
|
||||
|
||||
@@ -4,9 +4,8 @@ define(['../internal/isObjectLike', './isPlainObject', '../support'], function(i
|
||||
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;
|
||||
|
||||
@@ -27,13 +26,13 @@ define(['../internal/isObjectLike', './isPlainObject', '../support'], function(i
|
||||
* // => false
|
||||
*/
|
||||
function isElement(value) {
|
||||
return (value && value.nodeType === 1 && isObjectLike(value) &&
|
||||
(objToString.call(value).indexOf('Element') > -1)) || false;
|
||||
return !!value && value.nodeType === 1 && isObjectLike(value) &&
|
||||
(objToString.call(value).indexOf('Element') > -1);
|
||||
}
|
||||
// Fallback for environments without DOM support.
|
||||
if (!support.dom) {
|
||||
isElement = function(value) {
|
||||
return (value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value)) || false;
|
||||
return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ define(['../internal/baseIsEqual', '../internal/bindCallback', '../internal/isSt
|
||||
* equivalent. If `customizer` is provided it is invoked to compare values.
|
||||
* If `customizer` returns `undefined` comparisons are handled by the method
|
||||
* instead. The `customizer` is bound to `thisArg` and invoked with three
|
||||
* arguments; (value, other [, index|key]).
|
||||
* arguments: (value, other [, index|key]).
|
||||
*
|
||||
* **Note:** This method supports comparing arrays, booleans, `Date` objects,
|
||||
* numbers, `Object` objects, regexes, and strings. Objects are compared by
|
||||
|
||||
@@ -7,9 +7,8 @@ define(['../internal/isObjectLike'], function(isObjectLike) {
|
||||
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;
|
||||
|
||||
@@ -31,7 +30,7 @@ define(['../internal/isObjectLike'], function(isObjectLike) {
|
||||
* // => false
|
||||
*/
|
||||
function isError(value) {
|
||||
return (isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag) || false;
|
||||
return isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag;
|
||||
}
|
||||
|
||||
return isError;
|
||||
|
||||
@@ -7,9 +7,7 @@ define(['./isNative', '../internal/root'], function(isNative, root) {
|
||||
/**
|
||||
* Checks if `value` is a finite primitive number.
|
||||
*
|
||||
* **Note:** This method is based on ES `Number.isFinite`. See the
|
||||
* [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite)
|
||||
* for more details.
|
||||
* **Note:** This method is based on [`Number.isFinite`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -7,9 +7,8 @@ define(['../internal/baseIsFunction', './isNative', '../internal/root'], functio
|
||||
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,17 +1,11 @@
|
||||
define(['../internal/baseIsMatch', '../internal/bindCallback', '../internal/isStrictComparable', '../object/keys'], function(baseIsMatch, bindCallback, isStrictComparable, keys) {
|
||||
|
||||
/** Used for native method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
define(['../internal/baseIsMatch', '../internal/bindCallback', '../internal/isStrictComparable', '../object/keys', '../internal/toObject'], function(baseIsMatch, bindCallback, isStrictComparable, keys, toObject) {
|
||||
|
||||
/**
|
||||
* Performs a deep comparison between `object` and `source` to determine if
|
||||
* `object` contains equivalent property values. If `customizer` is provided
|
||||
* it is invoked to compare values. If `customizer` returns `undefined`
|
||||
* comparisons are handled by the method instead. The `customizer` is bound
|
||||
* to `thisArg` and invoked with three arguments; (value, other, index|key).
|
||||
* to `thisArg` and invoked with three arguments: (value, other, index|key).
|
||||
*
|
||||
* **Note:** This method supports comparing properties of arrays, booleans,
|
||||
* `Date` objects, numbers, `Object` objects, regexes, and strings. Functions
|
||||
@@ -49,13 +43,19 @@ define(['../internal/baseIsMatch', '../internal/bindCallback', '../internal/isSt
|
||||
var props = keys(source),
|
||||
length = props.length;
|
||||
|
||||
if (!length) {
|
||||
return true;
|
||||
}
|
||||
if (object == null) {
|
||||
return false;
|
||||
}
|
||||
customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3);
|
||||
if (!customizer && length == 1) {
|
||||
var key = props[0],
|
||||
value = source[key];
|
||||
|
||||
if (isStrictComparable(value)) {
|
||||
return object != null && value === object[key] && hasOwnProperty.call(object, key);
|
||||
return value === object[key] && (typeof value != 'undefined' || (key in toObject(object)));
|
||||
}
|
||||
}
|
||||
var values = Array(length),
|
||||
@@ -65,7 +65,7 @@ define(['../internal/baseIsMatch', '../internal/bindCallback', '../internal/isSt
|
||||
value = values[length] = source[props[length]];
|
||||
strictCompareFlags[length] = isStrictComparable(value);
|
||||
}
|
||||
return baseIsMatch(object, props, values, strictCompareFlags, customizer);
|
||||
return baseIsMatch(toObject(object), props, values, strictCompareFlags, customizer);
|
||||
}
|
||||
|
||||
return isMatch;
|
||||
|
||||
@@ -3,9 +3,8 @@ define(['./isNumber'], function(isNumber) {
|
||||
/**
|
||||
* Checks if `value` is `NaN`.
|
||||
*
|
||||
* **Note:** This method is not the same as native `isNaN` which returns `true`
|
||||
* for `undefined` and other non-numeric values. See the [ES5 spec](https://es5.github.io/#x15.1.2.4)
|
||||
* for more details.
|
||||
* **Note:** This method is not the same as [`isNaN`](https://es5.github.io/#x15.1.2.4)
|
||||
* which returns `true` for `undefined` and other non-numeric values.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -13,9 +13,8 @@ define(['../string/escapeRegExp', '../internal/isObjectLike'], function(escapeRe
|
||||
var fnToString = Function.prototype.toString;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
@@ -48,7 +47,7 @@ define(['../string/escapeRegExp', '../internal/isObjectLike'], function(escapeRe
|
||||
if (objToString.call(value) == funcTag) {
|
||||
return reNative.test(fnToString.call(value));
|
||||
}
|
||||
return (isObjectLike(value) && reHostCtor.test(value)) || false;
|
||||
return isObjectLike(value) && reHostCtor.test(value);
|
||||
}
|
||||
|
||||
return isNative;
|
||||
|
||||
@@ -7,9 +7,8 @@ define(['../internal/isObjectLike'], function(isObjectLike) {
|
||||
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;
|
||||
|
||||
@@ -36,7 +35,7 @@ define(['../internal/isObjectLike'], function(isObjectLike) {
|
||||
* // => false
|
||||
*/
|
||||
function isNumber(value) {
|
||||
return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag) || false;
|
||||
return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag);
|
||||
}
|
||||
|
||||
return isNumber;
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
define([], function() {
|
||||
|
||||
/**
|
||||
* Checks if `value` is the language type of `Object`.
|
||||
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
|
||||
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
||||
*
|
||||
* **Note:** See the [ES5 spec](https://es5.github.io/#x8) for more details.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
@@ -26,7 +24,7 @@ define([], function() {
|
||||
// Avoid a V8 JIT bug in Chrome 19-20.
|
||||
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
|
||||
var type = typeof value;
|
||||
return type == 'function' || (value && type == 'object') || false;
|
||||
return type == 'function' || (!!value && type == 'object');
|
||||
}
|
||||
|
||||
return isObject;
|
||||
|
||||
@@ -7,9 +7,8 @@ define(['./isNative', '../internal/shimIsPlainObject'], function(isNative, shimI
|
||||
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;
|
||||
|
||||
|
||||
@@ -7,9 +7,8 @@ define(['../internal/isObjectLike'], function(isObjectLike) {
|
||||
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;
|
||||
|
||||
|
||||
@@ -7,9 +7,8 @@ define(['../internal/isObjectLike'], function(isObjectLike) {
|
||||
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;
|
||||
|
||||
@@ -30,7 +29,7 @@ define(['../internal/isObjectLike'], function(isObjectLike) {
|
||||
* // => false
|
||||
*/
|
||||
function isString(value) {
|
||||
return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag) || false;
|
||||
return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);
|
||||
}
|
||||
|
||||
return isString;
|
||||
|
||||
@@ -45,9 +45,8 @@ define(['../internal/isLength', '../internal/isObjectLike'], function(isLength,
|
||||
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;
|
||||
|
||||
@@ -68,7 +67,7 @@ define(['../internal/isLength', '../internal/isObjectLike'], function(isLength,
|
||||
* // => false
|
||||
*/
|
||||
function isTypedArray(value) {
|
||||
return (isObjectLike(value) && isLength(value.length) && typedArrayTags[objToString.call(value)]) || false;
|
||||
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
|
||||
}
|
||||
|
||||
return isTypedArray;
|
||||
|
||||
Reference in New Issue
Block a user