• Take the given amount of items from the iterable or asynchronous iterable.

    Example

    const take2 = take(2);
    take2([1, 2, 3, 4, 5]); // [1, 2]

    Parameters

    • amount: number | bigint

      Amount of items to take.

    Returns (<Iterable>(iterable) => GeneratorOutput<Iterable>)

    Curried function with amount in context.

      • <Iterable>(iterable): GeneratorOutput<Iterable>
      • Type Parameters

        • Iterable extends IsomorphicIterable

        Parameters

        • iterable: Iterable

        Returns GeneratorOutput<Iterable>