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:
@@ -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);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user