async-fp
Collection of utilities for asynchronous functional programming.
Installation
# npm
npm install async-fp
# yarn
yarn add async-fp
# pnpm
pnpm install async-fp
#rush
rush add -p async-fp
AsyncContext
import { AsyncContext } from 'async-fp'
const context = new AsyncContext(async () => ({ config: 'async value' }))
await context.get() // => { config: 'async value' }
asyncAssert
import { asyncAssert } from 'async-fp'
const value = await asyncAssert(Promise.resolve({ a: 1 }), v => {
if (v.a === 1) throw new Error('not accepting 1')
})