Added new bulk upsert utility.

This commit is contained in:
DebaucheryLibrarian
2020-08-14 23:05:25 +02:00
parent b3f784686f
commit e996a45bf5
6 changed files with 42 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
'use strict';
function chunk(array, chunkSize) {
function chunk(array, chunkSize = 1000) {
return Array.from({ length: Math.ceil(array.length / chunkSize) })
.map((value, index) => array.slice(index * chunkSize, (index * chunkSize) + chunkSize));
}