Returns unique values in all the given collections.
It uses isEql for deep comparison of values.
Venn Diagram
Related
Syntax
import { union } from '@opentf/std';
union(
collections: unknown[][] = [],
by?: (val: unknown) => unknown
)
Examples
const evens = [2, 4, 6, 8];
const squares = [1, 4, 9];
union([evens, squares]) //=> [2, 4, 6, 8, 1, 9]
const setA = [1, 2, 3];
const setB = [2, 3];
const setC = [2, 3, 4, 5];
union([setA, setB, setC]) //=> [1, 2, 3, 4, 5]