UNPKG

ts-prime

Version:

A utility library for JavaScript and Typescript.

18 lines (17 loc) 426 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var purry_1 = require("./purry"); function times() { return purry_1.purry(_times, arguments); } exports.times = times; function _times(count, fn) { if (count < 0) { throw new RangeError('n must be a non-negative number'); } var res = []; for (var i = 0; i < count; i++) { res.push(fn(i)); } return res; }