Arrays.union()

Syntax

function union<T>(...arrays: readonly T[][]): T[]

Creates a new array with all elements from the given arrays, excluding duplicates.

Parameters
arrays Rest

The arrays to union.

Example

import { Arrays } from 'potence';

const array1 = [0, 1, 2, 3];
const array2 = [2, 3, 4, 5];

Arrays.union(array1, array2);  // -> [0, 1, 2, 3, 4, 5]