MCPcopy
hub / github.com/lodash/lodash / baseIsMatch

Function baseIsMatch

lodash.js:3404–3446  ·  view source on GitHub ↗

* The base implementation of `_.isMatch` without support for iteratee shorthands. * * @private * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @param {Array} matchData The property names, values, and compare

(object, source, matchData, customizer)

Source from the content-addressed store, hash-verified

3402 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
3403 */
3404 function baseIsMatch(object, source, matchData, customizer) {
3405 var index = matchData.length,
3406 length = index,
3407 noCustomizer = !customizer;
3408
3409 if (object == null) {
3410 return !length;
3411 }
3412 object = Object(object);
3413 while (index--) {
3414 var data = matchData[index];
3415 if ((noCustomizer && data[2])
3416 ? data[1] !== object[data[0]]
3417 : !(data[0] in object)
3418 ) {
3419 return false;
3420 }
3421 }
3422 while (++index < length) {
3423 data = matchData[index];
3424 var key = data[0],
3425 objValue = object[key],
3426 srcValue = data[1];
3427
3428 if (noCustomizer && data[2]) {
3429 if (objValue === undefined && !(key in object)) {
3430 return false;
3431 }
3432 } else {
3433 var stack = new Stack;
3434 if (customizer) {
3435 var result = customizer(objValue, srcValue, key, object, source, stack);
3436 }
3437 if (!(result === undefined
3438 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
3439 : result
3440 )) {
3441 return false;
3442 }
3443 }
3444 }
3445 return true;
3446 }
3447
3448 /**
3449 * The base implementation of `_.isNative` without bad shim checks.

Callers 3

baseMatchesFunction · 0.85
isMatchFunction · 0.85
isMatchWithFunction · 0.85

Calls 2

customizerFunction · 0.85
baseIsEqualFunction · 0.85

Tested by

no test coverage detected