source: node_modules/es-toolkit/dist/compat/util/times.d.ts

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 903 bytes
Line 
1/**
2 * Invokes the iteratee function n times, returning an array of the results.
3 *
4 * @template T The return type of the iteratee function.
5 * @param {number} n - The number of times to invoke iteratee.
6 * @param {(num: number) => T} iteratee - The function to invoke for each index.
7 * @returns {T[]} An array containing the results of invoking iteratee n times.
8 * @example
9 * times(3, (i) => i * 2); // => [0, 2, 4]
10 * times(2, () => 'es-toolkit'); // => ['es-toolkit', 'es-toolkit']
11 */
12declare function times<T>(n: number, iteratee: (num: number) => T): T[];
13/**
14 * Invokes the default iteratee function n times, returning an array of indices.
15 *
16 * @param {number} n - The number of times to invoke the default iteratee.
17 * @returns {number[]} An array containing indices from 0 to n-1.
18 * @example
19 * times(3); // => [0, 1, 2]
20 */
21declare function times(n: number): number[];
22
23export { times };
Note: See TracBrowser for help on using the repository browser.