Sha256: fea9d8040a83ad99b3432e790bf4eefc574ad5e448ec12139e757176c79ceca9
Contents?: true
Size: 1.2 KB
Versions: 14
Compression:
Stored size: 1.2 KB
Contents
var baseIsMatch = require('./baseIsMatch'), isStrictComparable = require('./isStrictComparable'), keys = require('../object/keys'); /** Used for native method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * The base implementation of `_.matches` which does not clone `source`. * * @private * @param {Object} source The object of property values to match. * @returns {Function} Returns the new function. */ function baseMatches(source) { var props = keys(source), length = props.length; if (length == 1) { var key = props[0], value = source[key]; if (isStrictComparable(value)) { return function(object) { return object != null && value === object[key] && hasOwnProperty.call(object, key); }; } } var values = Array(length), strictCompareFlags = Array(length); while (length--) { value = source[props[length]]; values[length] = value; strictCompareFlags[length] = isStrictComparable(value); } return function(object) { return baseIsMatch(object, props, values, strictCompareFlags); }; } module.exports = baseMatches;
Version data entries
14 entries across 7 versions & 1 rubygems