@jonahsnider/util

    Function repeat

    • Returns an iterable that repeats a given value a given number of times.

      Time complexity: O(n)

      Space complexity: O(n)

      Type Parameters

      • T

      Parameters

      • value: T

        The value to repeat

      • times: number

        The number of times to repeat the value

      Returns Iterable<T>

      An iterable that repeats value times number of times

      Iterable

      [...repeat('a', 3)]; // ['a', 'a', 'a']
      
      • fill to do the same thing but return an array
      • mapRepeat to do the same thing but with a function that generates values
    MMNEPVFCICPMFPCPTTAAATR