UNPKG

rambda

Version:

Lightweight faster alternative to Ramda

12 lines (9 loc) 308 B
import { map } from './map' import { range } from './range' export function times(fn, howMany){ if (arguments.length === 1) return _howMany => times(fn, _howMany) if (!Number.isInteger(howMany) || howMany < 0){ throw new RangeError('n must be an integer') } return map(fn, range(0, howMany)) }