Function elemOf

  • Checks if an element is in an array.

    Type Parameters

    • T

    Parameters

    • haystack: readonly T[]

    Returns ((needle) => boolean)

    A function that takes an element and returns true if it's in the array

      • (needle): boolean
      • Parameters

        • needle: T

        Returns boolean

    Example

    elemOf(['a', 'b'])('a') // true
    elemOf([1, 2, 3])(4) // false
    opt(1).exists(elemOf([1, 2])) // true

    See

Generated using TypeDoc