UNPKG

@orange_digital/chakra-datepicker

Version:
22 lines (21 loc) 615 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.chunkArray = void 0; /** * Returns an array with arrays of the given size. * * @param arr {Array} array to split * @param size {Integer} Size of every group */ function chunkArray(arr, size) { var index = 0; var arrayLength = arr.length; var tempArray = []; for (index = 0; index < arrayLength; index += size) { var chunk = arr.slice(index, index + size); // Do something if you want with the group tempArray.push(chunk); } return tempArray; } exports.chunkArray = chunkArray;