difference es-toolkit
Returns a new array excluding elements from the first array that are in the second array.
Usage
difference(firstArr, secondArr)
Use difference when you want to find the difference between two arrays. A new array is returned containing elements that are only in the first array and not in the second array.
The difference with an empty array is the same as the original array.
Parameters
firstArrT[]required
The reference array to find the difference from.
secondArrT[]required
The array containing elements to exclude from the first array.
Returns
A new array containing elements that are only in the first array and not in the second array.
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.