No Description

chunk.js 410B

1234567891011121314151617
  1. define(['./_setup'], function (_setup) {
  2. // Chunk a single array into multiple arrays, each containing `count` or fewer
  3. // items.
  4. function chunk(array, count) {
  5. if (count == null || count < 1) return [];
  6. var result = [];
  7. var i = 0, length = array.length;
  8. while (i < length) {
  9. result.push(_setup.slice.call(array, i, i += count));
  10. }
  11. return result;
  12. }
  13. return chunk;
  14. });