Sha256: 8301a22054860637c738c889bb561bc37dfba9a8acdfbb179f20a36c7ae48230

Contents?: true

Size: 1.41 KB

Versions: 121

Compression:

Stored size: 1.41 KB

Contents

var baseClone = require('./_baseClone'),
    baseMatches = require('./_baseMatches');

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

/**
 * Creates a function that performs a partial deep comparison between a given
 * object and `source`, returning `true` if the given object has equivalent
 * property values, else `false`.
 *
 * **Note:** The created function is equivalent to `_.isMatch` with `source`
 * partially applied.
 *
 * Partial comparisons will match empty array and empty object `source`
 * 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.0.0
 * @category Util
 * @param {Object} source The object of property values to match.
 * @returns {Function} Returns the new spec function.
 * @example
 *
 * var objects = [
 *   { 'a': 1, 'b': 2, 'c': 3 },
 *   { 'a': 4, 'b': 5, 'c': 6 }
 * ];
 *
 * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
 * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
 *
 * // Checking for several possible values
 * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
 * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
 */
function matches(source) {
  return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
}

module.exports = matches;

Version data entries

121 entries across 120 versions & 12 rubygems

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