Static
Readonly
asyncRun a flow of async and sync callback results
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Static
Readonly
flowRun a flow of callback results
Run a flow of results
type of the initial result
initial result
as final result
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Run a flow of results
type of the initial result
as final result
Static
allStatic
asyncResolve all possible async results to single IOk array result or IErr (like Promise.all but returns as result Result)
Array of async IResult or Functions return async IResult
Static
fromStatic
matchStatic
safeAsync function to match the value or error with try catch
Ok type
Err type
callback function
result
Static
safeStatic
wrapbuild safe Result wrapper for async callback function
function arguments
return type
error type
async Promise or callback function
wrapped function which returns Result Promise
Static
wrapbuild safe Result wrapper for callback function
function arguments
return type
error type
callback function
wrapped function which returns Result
const hello = Result.wrapFn((value: string) => `${value} world`);
// hello: (value: string) => IResult<string, unknown>
// example of strict generics usage (to set correct error type)
const jsonParse = Result.wrapFn<Parameters<typeof JSON.parse>, ReturnType<typeof JSON.parse>, SyntaxError>(JSON.parse);
const res: IResult<any, SyntaxError> = jsonParse('{ "hello": "world" }');
Result with static functions
Since
v2.0.0