Function repeatArray

  • Repeats an array. Constructs a new array with the entries from the original repeated the given number of times.

    Type Parameters

    • T

    Parameters

    • repeatCount: number
    • array: T[]

    Returns T[]

    A new array (does not mutate).

    import {repeatArray} from '@augment-vir/common';

    const result = repeatArray(3, ['a', 'b', 'c']);
    // result is `['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c']`