Options
All
  • Public
  • Public/Protected
  • All
Menu

Module times

Index

Functions Util

Util Functions

  • times<T>(n: number, iteratee?: T): ReturnType<T>
  • Invokes the iteratee n times, returning an array of the results of each invocation. The iteratee is invoked with one argument: (index).

    since

    5.0.0

    example
    times(3, String)
    // => ['0', '1', '2']

    times(4, () => 0)
    // => [0, 0, 0, 0]

    Type Parameters

    • T extends ((...args: any[]) => any)

    Parameters

    • n: number

      The number of times to invoke iteratee.

    • Optional iteratee: T

      The function invoked per iteration.

    Returns ReturnType<T>

    Returns the array of results.