source: imaps-frontend/node_modules/lodash-es/matchesProperty.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[d565449]1import baseClone from './_baseClone.js';
2import baseMatchesProperty from './_baseMatchesProperty.js';
3
4/** Used to compose bitmasks for cloning. */
5var 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 * **Note:** Multiple values can be checked by combining several matchers
17 * using `_.overSome`
18 *
19 * @static
20 * @memberOf _
21 * @since 3.2.0
22 * @category Util
23 * @param {Array|string} path The path of the property to get.
24 * @param {*} srcValue The value to match.
25 * @returns {Function} Returns the new spec function.
26 * @example
27 *
28 * var objects = [
29 * { 'a': 1, 'b': 2, 'c': 3 },
30 * { 'a': 4, 'b': 5, 'c': 6 }
31 * ];
32 *
33 * _.find(objects, _.matchesProperty('a', 4));
34 * // => { 'a': 4, 'b': 5, 'c': 6 }
35 *
36 * // Checking for several possible values
37 * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
38 * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
39 */
40function matchesProperty(path, srcValue) {
41 return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
42}
43
44export default matchesProperty;
Note: See TracBrowser for help on using the repository browser.