_.conformsTo(object, source)
Checks if object
conforms to source
by invoking the predicate properties of source
with the corresponding property values of object
.Note: This method is equivalent to _.conforms
when source
is partially applied.
Since
4.14.0
Arguments
object
(Object): The object to inspect.source
(Object): The object of property predicates to conform to.
Returns
(boolean): Returns true
if object
conforms, else false
.
Example
var object = { 'a': 1, 'b': 2 };_.conformsTo(object, { 'b': function(n) { return n > 1; } });// => true_.conformsTo(object, { 'b': function(n) { return n > 2; } });// => false
当前内容版权归 lodash.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 lodash.com .