3.0.0 • Published 4 years ago

@calebboyd/async v3.0.0

Weekly downloads
3,035
License
MIT
Repository
github
Last release
4 years ago

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

3.0.0

4 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.4.0

6 years ago

1.3.1

6 years ago