mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Bump to v3.6.0.
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
import baseIsMatch from './baseIsMatch';
|
||||
import constant from '../utility/constant';
|
||||
import isStrictComparable from './isStrictComparable';
|
||||
import keys from '../object/keys';
|
||||
|
||||
/** Used for native method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
import toObject from './toObject';
|
||||
|
||||
/**
|
||||
* The base implementation of `_.matches` which does not clone `source`.
|
||||
@@ -19,13 +15,17 @@ function baseMatches(source) {
|
||||
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)));
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ function baseMatches(source) {
|
||||
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