mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 08:37:49 +00:00
Bump to v3.2.0.
This commit is contained in:
24
internal/baseMatchesProperty.js
Normal file
24
internal/baseMatchesProperty.js
Normal file
@@ -0,0 +1,24 @@
|
||||
define(['./baseIsEqual', './isStrictComparable'], function(baseIsEqual, isStrictComparable) {
|
||||
|
||||
/**
|
||||
* The base implementation of `_.matchesProperty` which does not coerce `key`
|
||||
* to a string.
|
||||
*
|
||||
* @private
|
||||
* @param {string} key The key of the property to get.
|
||||
* @param {*} value The value to compare.
|
||||
* @returns {Function} Returns the new function.
|
||||
*/
|
||||
function baseMatchesProperty(key, value) {
|
||||
if (isStrictComparable(value)) {
|
||||
return function(object) {
|
||||
return object != null && object[key] === value;
|
||||
};
|
||||
}
|
||||
return function(object) {
|
||||
return object != null && baseIsEqual(value, object[key], null, true);
|
||||
};
|
||||
}
|
||||
|
||||
return baseMatchesProperty;
|
||||
});
|
||||
Reference in New Issue
Block a user