function-repeat
function repeat
construct an array by repeating a value (or function) a number of times, synchronously.
INSTALL:
npm install function-repeat
USAGE:
repeat(val, n)
var repeat = ; var res = ; // -> [1, 1, 1, 1]var res = ; // -> ['a', 'a', 'a', 'a']
repeat(fn, n, context, arguments,...)
var repeat = ; { return 2;}var res = ; // -> [2, 2, 2, 2, 2] { return x + y;}var res = ; // -> [5, 5, 5, 5, 5] { return this + x;}var res = ; // -> [5, 5, 5, 5, 5]
Function.prototype.repeat(n, context, arguments,...)
var repeat = ; { return 2;}var res = fn1; // -> [2, 2, 2, 2, 2] { return x + y;}var res = fn2; // -> [5, 5, 5, 5, 5] { return this + x;}var res = fn3; // -> [5, 5, 5, 5, 5]
SEE ALSO:
call-n-times, times, repeat-function
LICENSE:
MIT