mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Bump to v4.1.0.
This commit is contained in:
26
_baseMatchesProperty.js
Normal file
26
_baseMatchesProperty.js
Normal file
@@ -0,0 +1,26 @@
|
||||
var baseIsEqual = require('./_baseIsEqual'),
|
||||
get = require('./get'),
|
||||
hasIn = require('./hasIn');
|
||||
|
||||
/** Used to compose bitmasks for comparison styles. */
|
||||
var UNORDERED_COMPARE_FLAG = 1,
|
||||
PARTIAL_COMPARE_FLAG = 2;
|
||||
|
||||
/**
|
||||
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
|
||||
*
|
||||
* @private
|
||||
* @param {string} path The path of the property to get.
|
||||
* @param {*} srcValue The value to match.
|
||||
* @returns {Function} Returns the new function.
|
||||
*/
|
||||
function baseMatchesProperty(path, srcValue) {
|
||||
return function(object) {
|
||||
var objValue = get(object, path);
|
||||
return (objValue === undefined && objValue === srcValue)
|
||||
? hasIn(object, path)
|
||||
: baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = baseMatchesProperty;
|
||||
Reference in New Issue
Block a user