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

    Function takeArray

    • Returns the first count elements of an array.

      Type Parameters

      • T

      Parameters

      • array: readonly T[]

        The source array.

      • count: number

        Number of elements to take (must be a non-negative integer).

      Returns T[]

      takeArray([1, 2, 3, 4], 2) // => [1, 2]
      takeArray([1, 2], 10) // => [1, 2]