isMatch source npm
_.isMatch(object, source)
Performs a deep comparison between object
and source
to determine if
object
contains equivalent property values.
Note: This method supports comparing properties of arrays, booleans,
Date
objects, numbers, Object
objects, regexes, and strings. Functions
and DOM nodes are not supported. Provide a customizer function to extend
support for comparing other values.
Arguments
- object (Object)
The object to inspect.
- source (Object)
The object of property values to match.
Returns (boolean)
Returns true
if object
is a match, else false
.
Example
var object = { 'user': 'fred', 'age': 40 };
_.isMatch(object, { 'age': 40 });
// => true
_.isMatch(object, { 'age': 36 });
// => false