async-batcher

Batch calls to an async function.

Usage no npm install needed!

<script type="module">
  import asyncBatcher from 'https://cdn.skypack.dev/async-batcher';
</script>

README

async-batcher

Batch calls to an async function.

const Batcher = require('async-batcher')

const batcher = new Batcher(vals => vals.map(x => x + 1))

const twoThree = await Promise.all([
  batcher(1),
  batcher(2)
])
console.log(...twoThree, batcher.callCount) // 2 3 1