This method is like `isEqual` 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 up to six arguments: (objValue, othValue [, index|key, object, other, stack]).
function isGreeting(value) {
return /^h(?:i|ello)$/.test(value)
}
function customizer(objValue, othValue) {
if (isGreeting(objValue) && isGreeting(othValue)) {
return true
}
}
const array = ['hello', 'goodbye']
const other = ['hi', 'goodbye']
isEqualWith(array, other, customizer)
// => true
Name | Type | Attribute | Description |
---|---|---|---|
value | The value to compare. | ||
other | The other value to compare. | ||
customizer | The function to customize comparisons. |
{ "comment": "/**\r\n * This method is like `isEqual` 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 up to\r\n * six arguments: (objValue, othValue [, index|key, object, other, stack]).\r\n *\r\n * @since 4.0.0\r\n * @category Lang\r\n * @param {*} value The value to compare.\r\n * @param {*} other The other value to compare.\r\n * @param {Function} [customizer] The function to customize comparisons.\r\n * @returns {boolean} Returns `true` if the values are equivalent, 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, othValue) {\r\n * if (isGreeting(objValue) && isGreeting(othValue)) {\r\n * return true\r\n * }\r\n * }\r\n *\r\n * const array = ['hello', 'goodbye']\r\n * const other = ['hi', 'goodbye']\r\n *\r\n * isEqualWith(array, other, customizer)\r\n * // => true\r\n */", "meta": { "range": [ 1047, 1332 ], "filename": "isEqualWith.js", "lineno": 33, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo", "code": { "id": "astnode100004608", "name": "isEqualWith", "type": "FunctionDeclaration", "paramnames": [ "value", "other", "customizer" ] }, "vars": { "customizer": "isEqualWith~customizer", "result": "isEqualWith~result" } }, "description": "This method is like `isEqual` 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 up to\rsix arguments: (objValue, othValue [, index|key, object, other, stack]).", "since": "4.0.0", "tags": [ { "originalTitle": "category", "title": "category", "text": "Lang", "value": "Lang" } ], "params": [ { "type": { "names": [ "*" ] }, "description": "The value to compare.", "name": "value" }, { "type": { "names": [ "*" ] }, "description": "The other value to compare.", "name": "other" }, { "type": { "names": [ "function" ] }, "optional": true, "description": "The function to customize comparisons.", "name": "customizer" } ], "returns": [ { "type": { "names": [ "boolean" ] }, "description": "Returns `true` if the values are equivalent, else `false`." } ], "examples": [ "function isGreeting(value) {\r return /^h(?:i|ello)$/.test(value)\r}\r\rfunction customizer(objValue, othValue) {\r if (isGreeting(objValue) && isGreeting(othValue)) {\r return true\r }\r}\r\rconst array = ['hello', 'goodbye']\rconst other = ['hi', 'goodbye']\r\risEqualWith(array, other, customizer)\r// => true" ], "name": "isEqualWith", "longname": "isEqualWith", "kind": "function", "scope": "global", "___id": "T000002R000447", "___s": true, "filepath": "isEqualWith.js" }