Initial commit
[yaffs-website] / node_modules / sass-graph / node_modules / lodash / matchesProperty.js
1 var baseClone = require('./_baseClone'),
2     baseMatchesProperty = require('./_baseMatchesProperty');
3
4 /** Used to compose bitmasks for cloning. */
5 var CLONE_DEEP_FLAG = 1;
6
7 /**
8  * Creates a function that performs a partial deep comparison between the
9  * value at `path` of a given object to `srcValue`, returning `true` if the
10  * object value is equivalent, else `false`.
11  *
12  * **Note:** Partial comparisons will match empty array and empty object
13  * `srcValue` values against any array or object value, respectively. See
14  * `_.isEqual` for a list of supported value comparisons.
15  *
16  * @static
17  * @memberOf _
18  * @since 3.2.0
19  * @category Util
20  * @param {Array|string} path The path of the property to get.
21  * @param {*} srcValue The value to match.
22  * @returns {Function} Returns the new spec function.
23  * @example
24  *
25  * var objects = [
26  *   { 'a': 1, 'b': 2, 'c': 3 },
27  *   { 'a': 4, 'b': 5, 'c': 6 }
28  * ];
29  *
30  * _.find(objects, _.matchesProperty('a', 4));
31  * // => { 'a': 4, 'b': 5, 'c': 6 }
32  */
33 function matchesProperty(path, srcValue) {
34   return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
35 }
36
37 module.exports = matchesProperty;