artdaq_node_server  v1_00_07
 All Classes Namespaces Files Variables Pages
_baseMatchesProperty.js
1 var 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 
10 var COMPARE_PARTIAL_FLAG = 1,
11  COMPARE_UNORDERED_FLAG = 2;
12 
21 function 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 
33 module.exports = baseMatchesProperty;