xorBy es-toolkit
Creates a new array with elements that exist in only one of two arrays, based on values transformed by a given function.
Usage
xorBy(arr1, arr2, mapper)
Use xorBy when you want to find the symmetric difference of two arrays by comparing elements based on a specific criterion. It creates a new array with elements that exist in only one of the two arrays after transforming each element with a mapping function.
Elements with the same result from the mapping function are treated as one.
Parameters
The first array to compare.
The second array to compare.
A function that transforms each element into a value for comparison.
Returns
Returns a new array representing the symmetric difference calculated based on the mapping function's results.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.