async function batchMapFold(maxConcurrent, inputs, map, fold, outBase) {
  await batchProcess(maxConcurrent, inputs.map((input) => async () => { // Create an array of async jobs to map and fold each input
    const result = {
      input,
      output: await handleLater(() => map(input))
    }
    outBase = fold(outBase, result) // Folding happens syncronously (no awaits) so there's no concurrency concerns
  }))
  return outBase
}
// maxConcurrent is passed to the underlying call to `batchProcess`.
maxConcurrent is passed to the underlying call to `batchProcess`.
maxConcurrent is passed to the underlying call to ` batchProcess ` .
async function batchMapFold(maxConcurrent, inputs, map, fold, outBase) {
  await batchProcess(maxConcurrent, inputs.map((input) => async () => { 
    const result = {
      input,
      output: await handleLater(() => map(input))
    }
    outBase = fold(outBase, result) 
  }))
  return outBase
}
async function batchMapFold ( maxConcurrent , inputs , map , fold , outBase ) { await batchProcess ( maxConcurrent , inputs . map ( ( input ) => async ( ) => { const result = { input , output : await handleLater ( ( ) => map ( input ) ) } outBase = fold ( outBase , result ) } ) ) return outBase }
maxConcurrent is passed to the underlying call to `batchProcess`.
maxConcurrent is passed to the underlying call to ` batchProcess ` .
// Create an array of async jobs to map and fold each input // Folding happens syncronously (no awaits) so there's no concurrency concerns