softkave-js-utils
Version:
JavaScript & Typescript utility functions, types, and classes
11 lines • 329 B
JavaScript
import assert from 'assert';
export function loop(fn,
/** counting is `0`-index based, so last iteration would be `6` if count is
* `7`, while first iteration will be `0`. */
max, ...otherParams) {
assert(max >= 0);
for (let i = 0; i < max; i++) {
fn(i, ...otherParams);
}
}
//# sourceMappingURL=loop.js.map