4.17.11
3.10.1
2.4.2
1.3.1

_.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

argument
object
source
type
Object
Object
description
The object to inspect.
The object of property predicates to conform to.

Returns

(array)

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
var object = { a: 1, b: 2 };

_.conformsTo(object, {
  b: function (n) {
    return n > 1;
  },
});
// => true

_.conformsTo(object, {
  b: function (n) {
    return n > 2;
  },
});
// => false