This method is like `intersection` except that it accepts `comparator` which is invoked to compare elements of `arrays`. The order and references of result values are determined by the first array. The comparator is invoked with two arguments: (arrVal, othVal).
const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]
intersectionWith(objects, others, isEqual)
// => [{ 'x': 1, 'y': 2 }]
Name | Type | Attribute | Description |
---|---|---|---|
arrays | The arrays to inspect. | ||
comparator | The comparator invoked per element. |
{ "comment": "/**\r\n * This method is like `intersection` except that it accepts `comparator`\r\n * which is invoked to compare elements of `arrays`. The order and references\r\n * of result values are determined by the first array. The comparator is\r\n * invoked with two arguments: (arrVal, othVal).\r\n *\r\n * @since 4.0.0\r\n * @category Array\r\n * @param {...Array} [arrays] The arrays to inspect.\r\n * @param {Function} [comparator] The comparator invoked per element.\r\n * @returns {Array} Returns the new array of intersecting values.\r\n * @example\r\n *\r\n * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]\r\n * const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]\r\n *\r\n * intersectionWith(objects, others, isEqual)\r\n * // => [{ 'x': 1, 'y': 2 }]\r\n */", "meta": { "range": [ 955, 1322 ], "filename": "intersectionWith.js", "lineno": 25, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo", "code": { "id": "astnode100003867", "name": "intersectionWith", "type": "FunctionDeclaration", "paramnames": [ "arrays" ] }, "vars": { "comparator": "intersectionWith~comparator", "mapped": "intersectionWith~mapped" } }, "description": "This method is like `intersection` except that it accepts `comparator`\rwhich is invoked to compare elements of `arrays`. The order and references\rof result values are determined by the first array. The comparator is\rinvoked with two arguments: (arrVal, othVal).", "since": "4.0.0", "tags": [ { "originalTitle": "category", "title": "category", "text": "Array", "value": "Array" } ], "params": [ { "type": { "names": [ "Array" ] }, "optional": true, "variable": true, "description": "The arrays to inspect.", "name": "arrays" }, { "type": { "names": [ "function" ] }, "optional": true, "description": "The comparator invoked per element.", "name": "comparator" } ], "returns": [ { "type": { "names": [ "Array" ] }, "description": "Returns the new array of intersecting values." } ], "examples": [ "const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]\rconst others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]\r\rintersectionWith(objects, others, isEqual)\r// => [{ 'x': 1, 'y': 2 }]" ], "name": "intersectionWith", "longname": "intersectionWith", "kind": "function", "scope": "global", "___id": "T000002R000393", "___s": true, "filepath": "intersectionWith.js" }