diff
@guoba-ai/utils / array / diff
Function: diff()
function diff<T>(
a,
b,
fn?): T[];Defined in: array.ts:309
Return items in the first array that are not in the second array.
Type Parameters
T
T
Parameters
a
T[]
The source array
b
T[]
The array of items to exclude
fn?
(item) => unknown
Optional function to map items before comparison
Returns
T[]
A new array of items in a but not in b
Example
diff([1, 2, 3, 4], [2, 4]) // [1, 3]