source: trip-planner-front/node_modules/lodash/conforms.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 978 bytes
Line 
1var baseClone = require('./_baseClone'),
2 baseConforms = require('./_baseConforms');
3
4/** Used to compose bitmasks for cloning. */
5var CLONE_DEEP_FLAG = 1;
6
7/**
8 * Creates a function that invokes the predicate properties of `source` with
9 * the corresponding property values of a given object, returning `true` if
10 * all predicates return truthy, else `false`.
11 *
12 * **Note:** The created function is equivalent to `_.conformsTo` with
13 * `source` partially applied.
14 *
15 * @static
16 * @memberOf _
17 * @since 4.0.0
18 * @category Util
19 * @param {Object} source The object of property predicates to conform to.
20 * @returns {Function} Returns the new spec function.
21 * @example
22 *
23 * var objects = [
24 * { 'a': 2, 'b': 1 },
25 * { 'a': 1, 'b': 2 }
26 * ];
27 *
28 * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
29 * // => [{ 'a': 1, 'b': 2 }]
30 */
31function conforms(source) {
32 return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
33}
34
35module.exports = conforms;
Note: See TracBrowser for help on using the repository browser.