A collection of utilities for asynchronous functional programming.
Secure, type safe, asynchronous context for functional programming.
import { AsyncContext } from '@unional/async-context'
const context = new AsyncContext(async () => ({ config: 'async value' }))
await context.get() //=> { config: 'async value' }
@unional/gizmo is a library to create gizmo: an object with static or dynamic dependencies, with an optional start
function.
import { define, incubate } from '@unional/gizmo'
const gizmo = define({
async create() { return { foo: { blow() { /* ..snap.. */ } } } }
})
const gizmoWithStart = define({
async create() {
return [
{ foo2: { blow() { /* ..snap.. */ } } },
() => { /* ..snap.. */ }
]
}
})
const gizmoWithAsyncStart = define({
async create() {
return [
{ foo3: { blow() { /* ..snap.. */ } } },
async () => { /* ..snap.. */ }
]
}
})
const obj = await incubate().with(gizmo).create()
obj.foo.blow()