mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 01:57:50 +00:00
Bump to v3.7.0.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
define(['./isArguments', './isArray', './isFunction', '../internal/isLength', '../internal/isObjectLike', './isString', '../object/keys'], function(isArguments, isArray, isFunction, isLength, isObjectLike, isString, keys) {
|
||||
define(['../internal/getLength', './isArguments', './isArray', './isFunction', '../internal/isLength', '../internal/isObjectLike', './isString', '../object/keys'], function(getLength, isArguments, isArray, isFunction, isLength, isObjectLike, isString, keys) {
|
||||
|
||||
/**
|
||||
* Checks if `value` is empty. A value is considered empty unless it is an
|
||||
@@ -31,7 +31,7 @@ define(['./isArguments', './isArray', './isFunction', '../internal/isLength', '.
|
||||
if (value == null) {
|
||||
return true;
|
||||
}
|
||||
var length = value.length;
|
||||
var length = getLength(value);
|
||||
if (isLength(length) && (isArray(value) || isString(value) || isArguments(value) ||
|
||||
(isObjectLike(value) && isFunction(value.splice)))) {
|
||||
return !length;
|
||||
|
||||
@@ -21,7 +21,7 @@ define(['../internal/baseIsEqual', '../internal/bindCallback', '../internal/isSt
|
||||
* @category Lang
|
||||
* @param {*} value The value to compare.
|
||||
* @param {*} other The other value to compare.
|
||||
* @param {Function} [customizer] The function to customize comparing values.
|
||||
* @param {Function} [customizer] The function to customize value comparisons.
|
||||
* @param {*} [thisArg] The `this` binding of `customizer`.
|
||||
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
||||
* @example
|
||||
@@ -52,7 +52,7 @@ define(['../internal/baseIsEqual', '../internal/bindCallback', '../internal/isSt
|
||||
return value === other;
|
||||
}
|
||||
var result = customizer ? customizer(value, other) : undefined;
|
||||
return typeof result == 'undefined' ? baseIsEqual(value, other, customizer) : !!result;
|
||||
return result === undefined ? baseIsEqual(value, other, customizer) : !!result;
|
||||
}
|
||||
|
||||
return isEqual;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
define(['../internal/baseIsMatch', '../internal/bindCallback', '../internal/isStrictComparable', '../object/keys', '../internal/toObject'], function(baseIsMatch, bindCallback, isStrictComparable, keys, toObject) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/**
|
||||
* Performs a deep comparison between `object` and `source` to determine if
|
||||
* `object` contains equivalent property values. If `customizer` is provided
|
||||
@@ -17,7 +20,7 @@ define(['../internal/baseIsMatch', '../internal/bindCallback', '../internal/isSt
|
||||
* @category Lang
|
||||
* @param {Object} object The object to inspect.
|
||||
* @param {Object} source The object of property values to match.
|
||||
* @param {Function} [customizer] The function to customize comparing values.
|
||||
* @param {Function} [customizer] The function to customize value comparisons.
|
||||
* @param {*} [thisArg] The `this` binding of `customizer`.
|
||||
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
||||
* @example
|
||||
@@ -50,12 +53,13 @@ define(['../internal/baseIsMatch', '../internal/bindCallback', '../internal/isSt
|
||||
return false;
|
||||
}
|
||||
customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3);
|
||||
object = toObject(object);
|
||||
if (!customizer && length == 1) {
|
||||
var key = props[0],
|
||||
value = source[key];
|
||||
|
||||
if (isStrictComparable(value)) {
|
||||
return value === object[key] && (typeof value != 'undefined' || (key in toObject(object)));
|
||||
return value === object[key] && (value !== undefined || (key in object));
|
||||
}
|
||||
}
|
||||
var values = Array(length),
|
||||
@@ -65,7 +69,7 @@ define(['../internal/baseIsMatch', '../internal/bindCallback', '../internal/isSt
|
||||
value = values[length] = source[props[length]];
|
||||
strictCompareFlags[length] = isStrictComparable(value);
|
||||
}
|
||||
return baseIsMatch(toObject(object), props, values, strictCompareFlags, customizer);
|
||||
return baseIsMatch(object, props, values, strictCompareFlags, customizer);
|
||||
}
|
||||
|
||||
return isMatch;
|
||||
|
||||
@@ -4,7 +4,7 @@ define(['../string/escapeRegExp', '../internal/isObjectLike'], function(escapeRe
|
||||
var funcTag = '[object Function]';
|
||||
|
||||
/** Used to detect host constructors (Safari > 5). */
|
||||
var reHostCtor = /^\[object .+?Constructor\]$/;
|
||||
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
||||
|
||||
/** Used for native method references. */
|
||||
var objectProto = Object.prototype;
|
||||
@@ -19,7 +19,7 @@ define(['../string/escapeRegExp', '../internal/isObjectLike'], function(escapeRe
|
||||
var objToString = objectProto.toString;
|
||||
|
||||
/** Used to detect if a method is native. */
|
||||
var reNative = RegExp('^' +
|
||||
var reIsNative = RegExp('^' +
|
||||
escapeRegExp(objToString)
|
||||
.replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
||||
);
|
||||
@@ -45,9 +45,9 @@ define(['../string/escapeRegExp', '../internal/isObjectLike'], function(escapeRe
|
||||
return false;
|
||||
}
|
||||
if (objToString.call(value) == funcTag) {
|
||||
return reNative.test(fnToString.call(value));
|
||||
return reIsNative.test(fnToString.call(value));
|
||||
}
|
||||
return isObjectLike(value) && reHostCtor.test(value);
|
||||
return isObjectLike(value) && reIsHostCtor.test(value);
|
||||
}
|
||||
|
||||
return isNative;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
define([], function() {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/**
|
||||
* Checks if `value` is `undefined`.
|
||||
*
|
||||
@@ -17,7 +20,7 @@ define([], function() {
|
||||
* // => false
|
||||
*/
|
||||
function isUndefined(value) {
|
||||
return typeof value == 'undefined';
|
||||
return value === undefined;
|
||||
}
|
||||
|
||||
return isUndefined;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['../internal/arrayCopy', '../internal/isLength', '../object/values'], function(arrayCopy, isLength, values) {
|
||||
define(['../internal/arrayCopy', '../internal/getLength', '../internal/isLength', '../object/values'], function(arrayCopy, getLength, isLength, values) {
|
||||
|
||||
/**
|
||||
* Converts `value` to an array.
|
||||
@@ -16,7 +16,7 @@ define(['../internal/arrayCopy', '../internal/isLength', '../object/values'], fu
|
||||
* // => [2, 3]
|
||||
*/
|
||||
function toArray(value) {
|
||||
var length = value ? value.length : 0;
|
||||
var length = value ? getLength(value) : 0;
|
||||
if (!isLength(length)) {
|
||||
return values(value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user