times.js 301 B

1234567891011121314151617
  1. /**
  2. * Iterates over a callback a set amount of times
  3. */
  4. function times(n, callback, thisObj){
  5. var i = -1;
  6. while (++i < n) {
  7. if ( callback.call(thisObj, i) === false ) {
  8. break;
  9. }
  10. }
  11. }
  12. module.exports = times;