Midday / apps /dashboard /src /utils /process.ts
Jules
Final deployment with all fixes and verified content
c09f67c
// @ts-nocheck
export async function processPromisesBatch(items: any, limit: number, fn) {
const batches = [];
let result: any = [];
// Split the items into batches
for (let i = 0; i < items?.length; i += limit) {
batches.push(items.slice(i, i + limit));
}
// Process batches serially
for (const batch of batches) {
const processedBatch = await fn(batch);
result = result.concat(processedBatch);
}
return result;
}