{/* @generated by scripts/sync-content.mjs; do not edit */}
@sandlada/result/promise-result — eager operators on Promise<IResultOfT<T, E>>.
- Operates on:
Promise<IResultOfT<T, E>>; callbacks may be synchronous or asynchronous depending on the operator.
- Execution model: eager — the chain starts on the call and the returned Promise is already in flight.
- Not here: lazy thunks (
async-result), sync-to-async lift (bridge-result), Result construction (factories), synchronous operators (operators).
| Export |
Description |
Source |
map / mapErr |
Transform the success value / error with a sync callback. |
map.ts, mapErr.ts |
flatten |
Flattens a nested Promise<IResultOfT>. |
flatten.ts |
unwrapOr / unwrapOrElse |
Extract the value or fall back to a sync default. |
unwrapOr.ts, unwrapOrElse.ts |
| Export |
Description |
Source |
ap |
Applies a wrapped function to a wrapped value; a throwing applied function becomes Err. |
ap.ts |
combine |
Combines many Promises, selecting the first Err in input order. |
combine.ts |
combineWithAllErrors |
Combines many Promises, accumulating every error. |
combineWithAllErrors.ts |
- A rejection of the outer
Promise itself always stays a rejection; it is never converted into Err.
- Callback policy is split: the
map / tap / bimapAsync / *BindThrough families capture to values, the bind / match / catchErrAsync families propagate; mapOrAsync captures and returns the default. ap captures a throwing applied function as Err while a rejection of either operand stays a rejection. map throws an Error pointing at mapAsync when its sync mapper returns a thenable. See behavior-modes.md §4.6.
- This layer has no
unwrap / expect / orThrow; extraction goes through the unwrapOr* family, whose async rejections travel on the outer rejection channel.
unwrapOrAsync / unwrapOrElseAsync resolve to the bare value (Promise<A>), not to a Result.
combine / combineWithAllErrors start every input Promise immediately; short-circuiting affects only which result is selected.
- Naming: a
*Async suffix marks an async callback on Promise<IResultOfT>. Sync IResultOfT → Promise<IResultOfT> lifts live in bridge-result.
- Eager and lazy async are separate modules.
promise-result works on Promises that are already in flight, while async-result wraps thunks; keeping the two apart avoids conflating two execution models.