1 var baseClone = require('./_baseClone'),
2 baseMatches = require('./_baseMatches');
5 * Creates a function that performs a partial deep comparison between a given
6 * object and `source`, returning `true` if the given object has equivalent
7 * property values, else `false`.
9 * **Note:** The created function is equivalent to `_.isMatch` with `source`
12 * Partial comparisons will match empty array and empty object `source`
13 * values against any array or object value, respectively. See `_.isEqual`
14 * for a list of supported value comparisons.
20 * @param {Object} source The object of property values to match.
21 * @returns {Function} Returns the new spec function.
25 * { 'a': 1, 'b': 2, 'c': 3 },
26 * { 'a': 4, 'b': 5, 'c': 6 }
29 * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
30 * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
32 function matches(source) {
33 return baseMatches(baseClone(source, true));
36 module.exports = matches;