Sha256: 12cdfd3e6f0aa8c339960dcb38a46276ac595e74cfb642c6e75b7888fdeb2f9b
Contents?: true
Size: 471 Bytes
Versions: 62
Compression:
Stored size: 471 Bytes
Contents
/** * Iterates over a callback a set amount of times * returning the results */ function take(n, callback, thisObj){ var i = -1; var arr = []; if( !thisObj ){ while(++i < n){ arr[i] = callback(i, n); } } else { while(++i < n){ arr[i] = callback.call(thisObj, i, n); } } return arr; } module.exports = take;
Version data entries
62 entries across 62 versions & 1 rubygems