Security update for Core, with self-updated composer
[yaffs-website] / node_modules / grunt-legacy-util / node_modules / lodash / matches.js
1 var baseClone = require('./_baseClone'),
2     baseMatches = require('./_baseMatches');
3
4 /**
5  * Creates a function that performs a deep partial comparison between a given
6  * object and `source`, returning `true` if the given object has equivalent
7  * property values, else `false`.
8  *
9  * **Note:** This method supports comparing the same values as `_.isEqual`.
10  *
11  * @static
12  * @memberOf _
13  * @category Util
14  * @param {Object} source The object of property values to match.
15  * @returns {Function} Returns the new function.
16  * @example
17  *
18  * var users = [
19  *   { 'user': 'barney', 'age': 36, 'active': true },
20  *   { 'user': 'fred',   'age': 40, 'active': false }
21  * ];
22  *
23  * _.filter(users, _.matches({ 'age': 40, 'active': false }));
24  * // => [{ 'user': 'fred', 'age': 40, 'active': false }]
25  */
26 function matches(source) {
27   return baseMatches(baseClone(source, true));
28 }
29
30 module.exports = matches;