@eroyeroy/utils - v0.1.0
    Preparing search index...

    Function firstArrayItem

    • Returns the first element of an array. When called with a non-empty tuple, the return type is T (not T | undefined).

      Type Parameters

      • T

      Parameters

      • array: readonly [T, T]

        The source array.

      Returns T

      firstArrayItem([1, 2, 3]) // => 1
      firstArrayItem([]) // => undefined
    • Returns the first element of an array. When called with a non-empty tuple, the return type is T (not T | undefined).

      Type Parameters

      • T

      Parameters

      • array: readonly T[]

        The source array.

      Returns T | undefined

      firstArrayItem([1, 2, 3]) // => 1
      firstArrayItem([]) // => undefined