source: trip-planner-front/node_modules/lodash/_baseMatchesProperty.js@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.1 KB
Line 
1var baseIsEqual = require('./_baseIsEqual'),
2 get = require('./get'),
3 hasIn = require('./hasIn'),
4 isKey = require('./_isKey'),
5 isStrictComparable = require('./_isStrictComparable'),
6 matchesStrictComparable = require('./_matchesStrictComparable'),
7 toKey = require('./_toKey');
8
9/** Used to compose bitmasks for value comparisons. */
10var COMPARE_PARTIAL_FLAG = 1,
11 COMPARE_UNORDERED_FLAG = 2;
12
13/**
14 * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
15 *
16 * @private
17 * @param {string} path The path of the property to get.
18 * @param {*} srcValue The value to match.
19 * @returns {Function} Returns the new spec function.
20 */
21function baseMatchesProperty(path, srcValue) {
22 if (isKey(path) && isStrictComparable(srcValue)) {
23 return matchesStrictComparable(toKey(path), srcValue);
24 }
25 return function(object) {
26 var objValue = get(object, path);
27 return (objValue === undefined && objValue === srcValue)
28 ? hasIn(object, path)
29 : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
30 };
31}
32
33module.exports = baseMatchesProperty;
Note: See TracBrowser for help on using the repository browser.