source: imaps-frontend/node_modules/lodash-es/matches.js

main
Last change on this file 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
Line 
1import baseClone from './_baseClone.js';
2import baseMatches from './_baseMatches.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 a given
9 * object and `source`, returning `true` if the given object has equivalent
10 * property values, else `false`.
11 *
12 * **Note:** The created function is equivalent to `_.isMatch` with `source`
13 * partially applied.
14 *
15 * Partial comparisons will match empty array and empty object `source`
16 * values against any array or object value, respectively. See `_.isEqual`
17 * for a list of supported value comparisons.
18 *
19 * **Note:** Multiple values can be checked by combining several matchers
20 * using `_.overSome`
21 *
22 * @static
23 * @memberOf _
24 * @since 3.0.0
25 * @category Util
26 * @param {Object} source The object of property values to match.
27 * @returns {Function} Returns the new spec function.
28 * @example
29 *
30 * var objects = [
31 * { 'a': 1, 'b': 2, 'c': 3 },
32 * { 'a': 4, 'b': 5, 'c': 6 }
33 * ];
34 *
35 * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
36 * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
37 *
38 * // Checking for several possible values
39 * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
40 * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
41 */
42function matches(source) {
43 return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
44}
45
46export default matches;
Note: See TracBrowser for help on using the repository browser.