This method is like `isMatch` except that it accepts `customizer` which is invoked to compare values. If `customizer` returns `undefined`, comparisons are handled by the method instead. The `customizer` is invoked with five arguments: (objValue, srcValue, index|key, object, source).
function isGreeting(value) {
return /^h(?:i|ello)$/.test(value)
}
function customizer(objValue, srcValue) {
if (isGreeting(objValue) && isGreeting(srcValue)) {
return true
}
}
const object = { 'greeting': 'hello' }
const source = { 'greeting': 'hi' }
isMatchWith(object, source, customizer)
// => true
| Name | Type | Attribute | Description |
|---|---|---|---|
| object | The object to inspect. | ||
| source | The object of property values to match. | ||
| customizer | The function to customize comparisons. |
{
"comment": "/**\r\n * This method is like `isMatch` except that it accepts `customizer` which\r\n * is invoked to compare values. If `customizer` returns `undefined`, comparisons\r\n * are handled by the method instead. The `customizer` is invoked with five\r\n * arguments: (objValue, srcValue, index|key, object, source).\r\n *\r\n * @since 4.0.0\r\n * @category Lang\r\n * @param {Object} object The object to inspect.\r\n * @param {Object} source The object of property values to match.\r\n * @param {Function} [customizer] The function to customize comparisons.\r\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\r\n * @example\r\n *\r\n * function isGreeting(value) {\r\n * return /^h(?:i|ello)$/.test(value)\r\n * }\r\n *\r\n * function customizer(objValue, srcValue) {\r\n * if (isGreeting(objValue) && isGreeting(srcValue)) {\r\n * return true\r\n * }\r\n * }\r\n *\r\n * const object = { 'greeting': 'hello' }\r\n * const source = { 'greeting': 'hi' }\r\n *\r\n * isMatchWith(object, source, customizer)\r\n * // => true\r\n */",
"meta": {
"range": [
1118,
1316
],
"filename": "isMatchWith.js",
"lineno": 34,
"path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
"code": {
"id": "astnode100004867",
"name": "isMatchWith",
"type": "FunctionDeclaration",
"paramnames": [
"object",
"source",
"customizer"
]
},
"vars": {
"customizer": "isMatchWith~customizer"
}
},
"description": "This method is like `isMatch` except that it accepts `customizer` which\ris invoked to compare values. If `customizer` returns `undefined`, comparisons\rare handled by the method instead. The `customizer` is invoked with five\rarguments: (objValue, srcValue, index|key, object, source).",
"since": "4.0.0",
"tags": [
{
"originalTitle": "category",
"title": "category",
"text": "Lang",
"value": "Lang"
}
],
"params": [
{
"type": {
"names": [
"Object"
]
},
"description": "The object to inspect.",
"name": "object"
},
{
"type": {
"names": [
"Object"
]
},
"description": "The object of property values to match.",
"name": "source"
},
{
"type": {
"names": [
"function"
]
},
"optional": true,
"description": "The function to customize comparisons.",
"name": "customizer"
}
],
"returns": [
{
"type": {
"names": [
"boolean"
]
},
"description": "Returns `true` if `object` is a match, else `false`."
}
],
"examples": [
"function isGreeting(value) {\r return /^h(?:i|ello)$/.test(value)\r}\r\rfunction customizer(objValue, srcValue) {\r if (isGreeting(objValue) && isGreeting(srcValue)) {\r return true\r }\r}\r\rconst object = { 'greeting': 'hello' }\rconst source = { 'greeting': 'hi' }\r\risMatchWith(object, source, customizer)\r// => true"
],
"name": "isMatchWith",
"longname": "isMatchWith",
"kind": "function",
"scope": "global",
"___id": "T000002R000465",
"___s": true,
"filepath": "isMatchWith.js"
}