1 var baseIsMatch = require('../internal/baseIsMatch'),
2 bindCallback = require('../internal/bindCallback'),
3 getMatchData = require('../internal/getMatchData');
6 * Performs a deep comparison between `object` and `source` to determine if
7 * `object` contains equivalent property values. If `customizer` is provided
8 * it's invoked to compare values. If `customizer` returns `undefined`
9 * comparisons are handled by the method instead. The `customizer` is bound
10 * to `thisArg` and invoked with three arguments: (value, other, index|key).
12 * **Note:** This method supports comparing properties of arrays, booleans,
13 * `Date` objects, numbers, `Object` objects, regexes, and strings. Functions
14 * and DOM nodes are **not** supported. Provide a customizer function to extend
15 * support for comparing other values.
20 * @param {Object} object The object to inspect.
21 * @param {Object} source The object of property values to match.
22 * @param {Function} [customizer] The function to customize value comparisons.
23 * @param {*} [thisArg] The `this` binding of `customizer`.
24 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
27 * var object = { 'user': 'fred', 'age': 40 };
29 * _.isMatch(object, { 'age': 40 });
32 * _.isMatch(object, { 'age': 36 });
35 * // using a customizer callback
36 * var object = { 'greeting': 'hello' };
37 * var source = { 'greeting': 'hi' };
39 * _.isMatch(object, source, function(value, other) {
40 * return _.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined;
44 function isMatch(object, source, customizer, thisArg) {
45 customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
46 return baseIsMatch(object, getMatchData(source), customizer);
49 module.exports = isMatch;