Async
Errors are values: SafePromise turns a promise that may reject into one that resolves to a result, and WithCleanup runs a cleanup either way.
import { SafePromise } from "@pdfking/tfunc"
const result = await SafePromise(Promise.reject(new Error("Failed")))
result.error?.enum // "INTERNAL_ERROR"
- Wait: WaitPromises for an array or a record of promises, Sleep
- Stream: MapAsync, FilterAsync, Collect
- Share: Channel, Broadcast, LockManager
For plain iterables, see Sequences.