Function initial

  • Get all elements except the last one of an iterable or asynchronous iterable.

    Example

    initial([1, 2, 3]); // [1, 2]
    

    Returns

    Iterable with all items except the last one.

    Type Parameters

    • Iterable extends AsynchronousIterable<unknown>

    Parameters

    • iterable: Iterable

      Iterable to get the items from.

    Returns Iterable extends ReadOnlyArray<unknown> ? IterableIterator<Initial<Iterable>[number]> : GeneratorOutput<Iterable>