@mirei/ts-collections
    Preparing search index...

    Function repeat

    • Creates a sequence that repeats the specified element a fixed number of times.

      Type Parameters

      • TElement

        Type of the repeated element.

      Parameters

      • element: TElement

        Element to repeat.

      • count: number

        Number of repetitions to produce.

      Returns IEnumerable<TElement>

      A sequence containing element repeated count times.

      Enumeration is deferred. When count is zero or negative, the resulting sequence is empty.

      const repeated = repeat('a', 5).toArray();
      console.log(repeated); // ['a', 'a', 'a', 'a', 'a']