a zip code crypto-currency system good for red ONLY

_baseMatchesProperty.js 1.1KB

12345678910111213141516171819202122232425262728293031323334
  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. /** Used to compose bitmasks for value comparisons. */
  9. var COMPARE_PARTIAL_FLAG = 1,
  10. COMPARE_UNORDERED_FLAG = 2;
  11. /**
  12. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  13. *
  14. * @private
  15. * @param {string} path The path of the property to get.
  16. * @param {*} srcValue The value to match.
  17. * @returns {Function} Returns the new spec function.
  18. */
  19. function baseMatchesProperty(path, srcValue) {
  20. if (isKey(path) && isStrictComparable(srcValue)) {
  21. return matchesStrictComparable(toKey(path), srcValue);
  22. }
  23. return function(object) {
  24. var objValue = get(object, path);
  25. return (objValue === undefined && objValue === srcValue)
  26. ? hasIn(object, path)
  27. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  28. };
  29. }
  30. module.exports = baseMatchesProperty;