Files
lodash/internal/baseMatchesProperty.js
John-David Dalton 3ccb5e7da3 Bump to v3.2.0.
2015-12-16 17:46:22 -08:00

25 lines
713 B
JavaScript

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;
});