dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
14 lines (13 loc) • 404 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.chunk = void 0;
const chunk = (items, chunkSize) => {
// important not to mute the original array
const itemsClone = [...items];
const chunkedItems = [];
while (itemsClone.length > 0) {
chunkedItems.push(itemsClone.splice(0, chunkSize));
}
return chunkedItems;
};
exports.chunk = chunk;