mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
858 B
30 lines
858 B
var baseIsMatch = require('./_baseIsMatch'),
|
|
getMatchData = require('./_getMatchData');
|
|
|
|
/**
|
|
* Performs a deep comparison between `object` and `source` to determine if
|
|
* `object` contains equivalent property values.
|
|
*
|
|
* **Note:** This method supports comparing the same values as `_.isEqual`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @category Lang
|
|
* @param {Object} object The object to inspect.
|
|
* @param {Object} source 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
|
|
*/
|
|
function isMatch(object, source) {
|
|
return object === source || baseIsMatch(object, source, getMatchData(source));
|
|
}
|
|
|
|
module.exports = isMatch;
|
|
|