Function contains

Returns true if contents of needles is contained by haystack.

const a = ['apples','oranges','pears','mandarins'];
const b = ['pears', 'apples'];
contains(a, b); // True

const c = ['pears', 'bananas'];
contains(a, b); // False ('bananas' does not exist in a)
  • Type Parameters

    • V

    Parameters

    • haystack: ArrayLike<V>
    • needles: ArrayLike<V>
    • eq: ((a: V, b: V) => boolean) = ...
        • (a, b): boolean
        • Default comparer function is equiv to checking a === b. Use isEqualValueDefault to compare by value, via comparing JSON string representation.

          Parameters

          Returns boolean

    Returns boolean