UNPKG

ember-app-scheduler

Version:

Ember addon to schedule work at different phases of app life cycle.

25 lines (19 loc) 471 B
/** * 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;