Function intersection

Returns elements that appear in both arrays. Preserves uniqueness and order from the main array.

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

    • T

      Element type

    Parameters

    • other: readonly T[]

      Array to intersect with

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

    Array of common elements