• Repeats value at count times as a list.

    Parameters

    • count: number

      The times to repeat.

    Returns (<T>(value) => List<T>)

    The repeated list.

    Examples

    import { range, replicate, toIterator } from "./list.ts";
    import { assertEquals } from "../deps.ts";

    const replicated = replicate(4)(42);
    const iter = toIterator(replicated);
    assertEquals(iter.next(), { value: 42, done: false });
    assertEquals(iter.next(), { value: 42, done: false });
    assertEquals(iter.next(), { value: 42, done: false });
    assertEquals(iter.next(), { value: 42, done: false });
    assertEquals(iter.next(), { value: undefined, done: true });
      • <T>(value): List<T>
      • Type Parameters

        • T

        Parameters

        • value: T

        Returns List<T>

Generated using TypeDoc