nova-ui/assets/services/utilities.js

13 lines
304 B
JavaScript
Raw Normal View History

2024-05-08 19:55:36 +03:00
export const ZERO_ELEMENT = 0
2024-05-08 19:55:36 +03:00
export function getBatches(array, batchSize) {
const batches = []
while (array.length) {
batches.push(array.splice(ZERO_ELEMENT, batchSize))
}
return batches
}
2024-05-08 19:55:36 +03:00
export async function sleep(ms) {
return await new Promise((resolve) => setTimeout(resolve, ms))
}