xorWith es-toolkit
Creates a new array with elements that exist in only one of two arrays using a given comparison function.
Usage
xorWith(arr1, arr2, areElementsEqual)
Use xorWith when you want to find the symmetric difference with complex objects or special comparison conditions. It creates a new array with elements that exist in only one of the two arrays by comparing elements with a user-defined equality function.
More complex comparisons are also possible.
Parameters
The first array to compare.
The second array to compare.
A function that determines if two elements are equal. It should return true if they are the same, and false otherwise.
Returns
Returns a new array representing the symmetric difference calculated based on the custom equality function.
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.