Function repeat

  • Returns a Stream that yields the same value 'times' number of times.

    Type Parameters

    • T

      Type of the value.

    Parameters

    • value: ValueOrFactory<T>

      Value to repeat.

    • times: number = Number.POSITIVE_INFINITY

      Number of times to repeat the value.

    Returns Stream<T>

    A Stream that yields the value 'times' number of times.

    const result = repeat('A', 3);
    console.log([...result]); // ['A', 'A', 'A']