|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
387 bytes
|
| Line | |
|---|
| 1 | var _setup = require('./_setup.js');
|
|---|
| 2 |
|
|---|
| 3 | // Chunk a single array into multiple arrays, each containing `count` or fewer
|
|---|
| 4 | // items.
|
|---|
| 5 | function chunk(array, count) {
|
|---|
| 6 | if (count == null || count < 1) return [];
|
|---|
| 7 | var result = [];
|
|---|
| 8 | var i = 0, length = array.length;
|
|---|
| 9 | while (i < length) {
|
|---|
| 10 | result.push(_setup.slice.call(array, i, i += count));
|
|---|
| 11 | }
|
|---|
| 12 | return result;
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | module.exports = chunk;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.