differenceWith es-toolkit
Computes the difference of two arrays using a custom comparison function and returns a new array.
Usage
differenceWith(firstArr, secondArr, areItemsEqual)
Use differenceWith when you want to compute the difference between two arrays using a custom comparison function. It determines if two elements are equal through the comparison function, and returns elements that exist only in the first array.
You can compare elements with complex conditions.
Parameters
The base array to compute the difference from.
The array containing elements to exclude from the first array.
The function that determines if two elements are equal.
Returns
A new array containing elements that are determined to exist only in the first array according to the comparison 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.