@nevware21/ts-utils
    Preparing search index...

    Function arrIntersection

    • The arrIntersection() method returns a new array containing elements that exist in all provided arrays. Uses strict equality (===) for comparison and maintains order from the first array.

      Type Parameters

      • T

        Identifies the base type of array elements

      Parameters

      • ...arrays: ArrayLike<T>[]

        Two or more arrays to intersect

      Returns T[]

      A new array containing elements common to all arrays

      0.14.0

      arrIntersection([1, 2, 3], [2, 3, 4]);           // [2, 3]
      arrIntersection([1, 2, 3], [2, 3], [3, 4]); // [3]
      arrIntersection(["a", "b"], ["b", "c"]); // ["b"]
      arrIntersection([1, 2], [3, 4]); // []
      arrIntersection([1, 2, 3], []); // []

      // Array-like objects
      arrIntersection({ length: 3, 0: 1, 1: 2, 2: 3 }, [2, 3]); // [2, 3]