react / wstein / node_modules / jest-cli / node_modules / istanbul / node_modules / js-yaml / node_modules / argparse / node_modules / lodash / internal / baseIsMatch.js
80742 viewsvar baseIsEqual = require('./baseIsEqual'),1toObject = require('./toObject');23/**4* The base implementation of `_.isMatch` without support for callback5* shorthands and `this` binding.6*7* @private8* @param {Object} object The object to inspect.9* @param {Array} matchData The propery names, values, and compare flags to match.10* @param {Function} [customizer] The function to customize comparing objects.11* @returns {boolean} Returns `true` if `object` is a match, else `false`.12*/13function baseIsMatch(object, matchData, customizer) {14var index = matchData.length,15length = index,16noCustomizer = !customizer;1718if (object == null) {19return !length;20}21object = toObject(object);22while (index--) {23var data = matchData[index];24if ((noCustomizer && data[2])25? data[1] !== object[data[0]]26: !(data[0] in object)27) {28return false;29}30}31while (++index < length) {32data = matchData[index];33var key = data[0],34objValue = object[key],35srcValue = data[1];3637if (noCustomizer && data[2]) {38if (objValue === undefined && !(key in object)) {39return false;40}41} else {42var result = customizer ? customizer(objValue, srcValue, key) : undefined;43if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {44return false;45}46}47}48return true;49}5051module.exports = baseIsMatch;525354