Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / globule / node_modules / lodash / matchesProperty.js
1 var baseClone = require('./_baseClone'),
2     baseMatchesProperty = require('./_baseMatchesProperty');
3
4 /**
5  * Creates a function that performs a partial deep 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:** Partial comparisons will match empty array and empty object
10  * `srcValue` values against any array or object value, respectively. See
11  * `_.isEqual` for a list of supported value comparisons.
12  *
13  * @static
14  * @memberOf _
15  * @since 3.2.0
16  * @category Util
17  * @param {Array|string} path The path of the property to get.
18  * @param {*} srcValue The value to match.
19  * @returns {Function} Returns the new spec function.
20  * @example
21  *
22  * var objects = [
23  *   { 'a': 1, 'b': 2, 'c': 3 },
24  *   { 'a': 4, 'b': 5, 'c': 6 }
25  * ];
26  *
27  * _.find(objects, _.matchesProperty('a', 4));
28  * // => { 'a': 4, 'b': 5, 'c': 6 }
29  */
30 function matchesProperty(path, srcValue) {
31   return baseMatchesProperty(path, baseClone(srcValue, true));
32 }
33
34 module.exports = matchesProperty;