Creates an array with the values of first, not included in the other arrays.
It uses isEql for deep comparison of values.
Venn Diagram
Related
Syntax
import { diff } from '@opentf/std';
diff(
collections: unknown[][] = [],
by?: (val: unknown) => unknown
)
Examples
const odds = [1, 3, 5, 7, 9];
const squares = [1, 4, 9];
diff([odds, squares]); //=> [3, 5, 7]
const bucket1 = ["apple", "mango", "orange"]
const bucket2 =["Mango", "Apple"]
diff([bucket1, bucket2], (f) => f.toLowerCase()); // ['orange']
diff([[{ a: 1 }, {a: 3}], [{ a: 1 }, { a: 2 }]]); //=> [{a: 3}]