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:
952 bytes
|
Line | |
---|
1 | import baseConformsTo from './_baseConformsTo.js';
|
---|
2 | import keys from './keys.js';
|
---|
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 | export default conformsTo;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.