Projekt

Obecné

Profil

Stáhnout (954 Bajtů) Statistiky
| Větev: | Revize:
1
var baseConformsTo = require('./_baseConformsTo'),
2
    keys = require('./keys');
3

    
4
/**
5
 * Checks if `object` conforms to `source` by invoking the predicate
6
 * properties of `source` with the corresponding property values of `object`.
7
 *
8
 * **Note:** This method is equivalent to `_.conforms` when `source` is
9
 * partially applied.
10
 *
11
 * @static
12
 * @memberOf _
13
 * @since 4.14.0
14
 * @category Lang
15
 * @param {Object} object The object to inspect.
16
 * @param {Object} source The object of property predicates to conform to.
17
 * @returns {boolean} Returns `true` if `object` conforms, else `false`.
18
 * @example
19
 *
20
 * var object = { 'a': 1, 'b': 2 };
21
 *
22
 * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
23
 * // => true
24
 *
25
 * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
26
 * // => false
27
 */
28
function conformsTo(object, source) {
29
  return source == null || baseConformsTo(object, source, keys(source));
30
}
31

    
32
module.exports = conformsTo;
(269-269/571)