@calebboyd/async
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

async

Useful async tools optimized for dx.

a queue, a lock, and concurrent map and each

Get it on npm: npm install @calebboyd/async


Example (queue)

import { q } from '@calebboyd/async'

const { ready, add, empty } = q(10)

function fetchQux(qux) {
  return fetch(`https://example.com/${qux}`)
}

const fooBars = Array.from(Array(100).keys())
for (const value of fooBars) {
  await ready()
  add(fetchQux, value)
}
return empty()

Example (gowait)

import { gowait, delay } from '@calebboyd/async'

const [err, value] = await gowait(delay(100, 42))
console.log(value) //42

see the generated documentation here

Dependencies (0)

    Dev Dependencies (15)

    Package Sidebar

    Install

    npm i @calebboyd/async

    Weekly Downloads

    3,018

    Version

    3.0.0

    License

    MIT

    Unpacked Size

    45.9 kB

    Total Files

    29

    Last publish

    Collaborators

    • calebboyd