Function reverse

  • Converts an indexed (array-like) value into a reversed iterable.

    This is to produce a maximum-performance reversed iterable, by wrapping data into iterable and applying logical reversal (without any processing) at the same time.

    import {reverse} from 'iter-ops';

    const i = reverse('word'); //=> Iterable<string>

    console.log([...i]); //=> ['d', 'r', 'o', 'w']

    Type Parameters

    • T

    Parameters

    • input: ArrayLike<T>

    Returns Iterable<T>

    Throws

    TypeError: 'An array-like value was expected: ...' when the input is not array-like.