UNPKG

softkave-js-utils

Version:

JavaScript & Typescript utility functions, types, and classes

14 lines 373 B
import assert from 'assert'; /** * See {@link loop} * Returns a list containing results of `fn` invocations */ export function loopAndCollate(fn, max, ...otherParams) { assert(max >= 0); const result = Array(max); for (let i = 0; i < max; i++) { result[i] = fn(i, ...otherParams); } return result; } //# sourceMappingURL=loopAndCollate.js.map