Function union

Combines two arrays removing duplicates. Preserves order with source array elements first, then new elements from other.

union([3, 4])([1, 2, 3]);
// => [1, 2, 3, 4]
  • Type Parameters

    • T

      Element type

    Parameters

    • other: readonly T[]

      Array to combine with

    Returns (source: readonly T[]) => T[]

    Combined array with unique elements