4.17.11
3.10.1
2.4.2
1.3.1

_.conforms(source)

Creates a function that invokes the predicate properties of source with the corresponding property values of a given object, returning true if all predicates return truthy, else false.

Note: The created function is equivalent to _.conformsTo with source partially applied.

Since

4.0.0

Arguments

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

Returns

(array)

Example

var objects = [
  { a: 2, b: 1 },
  { a: 1, b: 2 },
];

_.filter(
  objects,
  _.conforms({
    b: function (n) {
      return n > 1;
    },
  })
);
// => [{ 'a': 1, 'b': 2 }]
var objects = [
  { a: 2, b: 1 },
  { a: 1, b: 2 },
];

_.filter(
  objects,
  _.conforms({
    b: function (n) {
      return n > 1;
    },
  })
);
// => [{ 'a': 1, 'b': 2 }]