d4356fb956a015d3d37fe0da28113c3f1a23b60c
[yaffs-website] / node_modules / grunt-legacy-log-utils / node_modules / lodash / matchesProperty.js
1 var baseClone = require('./_baseClone'),
2     baseMatchesProperty = require('./_baseMatchesProperty');
3
4 /**
5  * Creates a function that performs a deep partial comparison between the
6  * value at `path` of a given object to `srcValue`, returning `true` if the
7  * object value is equivalent, else `false`.
8  *
9  * **Note:** This method supports comparing the same values as `_.isEqual`.
10  *
11  * @static
12  * @memberOf _
13  * @category Util
14  * @param {Array|string} path The path of the property to get.
15  * @param {*} srcValue The value to match.
16  * @returns {Function} Returns the new function.
17  * @example
18  *
19  * var users = [
20  *   { 'user': 'barney' },
21  *   { 'user': 'fred' }
22  * ];
23  *
24  * _.find(users, _.matchesProperty('user', 'fred'));
25  * // => { 'user': 'fred' }
26  */
27 function matchesProperty(path, srcValue) {
28   return baseMatchesProperty(path, baseClone(srcValue, true));
29 }
30
31 module.exports = matchesProperty;