Sha256: 000877d1b0f3d96fa96340eacd5e83109ed2166e0698a934c1ed2bd2a5d78e51

Contents?: true

Size: 1.42 KB

Versions: 120

Compression:

Stored size: 1.42 KB

Contents

var baseClone = require('./_baseClone'),
    baseMatchesProperty = require('./_baseMatchesProperty');

/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG = 1;

/**
 * Creates a function that performs a partial deep comparison between the
 * value at `path` of a given object to `srcValue`, returning `true` if the
 * object value is equivalent, else `false`.
 *
 * **Note:** Partial comparisons will match empty array and empty object
 * `srcValue` values against any array or object value, respectively. See
 * `_.isEqual` for a list of supported value comparisons.
 *
 * **Note:** Multiple values can be checked by combining several matchers
 * using `_.overSome`
 *
 * @static
 * @memberOf _
 * @since 3.2.0
 * @category Util
 * @param {Array|string} path The path of the property to get.
 * @param {*} srcValue The value to match.
 * @returns {Function} Returns the new spec function.
 * @example
 *
 * var objects = [
 *   { 'a': 1, 'b': 2, 'c': 3 },
 *   { 'a': 4, 'b': 5, 'c': 6 }
 * ];
 *
 * _.find(objects, _.matchesProperty('a', 4));
 * // => { 'a': 4, 'b': 5, 'c': 6 }
 *
 * // Checking for several possible values
 * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
 * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
 */
function matchesProperty(path, srcValue) {
  return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
}

module.exports = matchesProperty;

Version data entries

120 entries across 119 versions & 12 rubygems

Version Path
rapid_stack-0.1.1 templates/FrontEnd/node_modules/lodash/matchesProperty.js
rapid_stack-0.1.0 templates/FrontEnd/node_modules/lodash/matchesProperty.js
immosquare-cleaner-0.1.60 node_modules/lodash/matchesProperty.js
immosquare-cleaner-0.1.59 node_modules/lodash/matchesProperty.js
immosquare-cleaner-0.1.58 node_modules/lodash/matchesProperty.js
immosquare-cleaner-0.1.57 node_modules/lodash/matchesProperty.js
immosquare-cleaner-0.1.56 node_modules/lodash/matchesProperty.js
immosquare-cleaner-0.1.55 node_modules/lodash/matchesProperty.js
immosquare-cleaner-0.1.54 node_modules/lodash/matchesProperty.js
immosquare-cleaner-0.1.53 node_modules/lodash/matchesProperty.js
immosquare-cleaner-0.1.52 node_modules/lodash/matchesProperty.js
trusty-cms-6.3.1 node_modules/lodash/matchesProperty.js
immosquare-cleaner-0.1.51 node_modules/lodash/matchesProperty.js
boring_generators-0.15.0 tmp/templates/app_template/node_modules/lodash/matchesProperty.js
clapton-0.0.26 lib/clapton/javascripts/node_modules/lodash/matchesProperty.js
clapton-0.0.25 lib/clapton/javascripts/node_modules/lodash/matchesProperty.js
immosquare-cleaner-0.1.50 node_modules/lodash/matchesProperty.js
clapton-0.0.24 lib/clapton/javascripts/node_modules/lodash/matchesProperty.js
clapton-0.0.23 lib/clapton/javascripts/node_modules/lodash/matchesProperty.js
clapton-0.0.22 lib/clapton/javascripts/node_modules/lodash/matchesProperty.js