Static methods

staticattempt<D, F>(f:() ‑> D, report:Dynamic ‑> F):Outcome<D, F>

Try to run f and wraps the result in Success, * thrown exceptions are transformed by report then wrapped into a Failure

staticequals<D, F>(outcome:Outcome<D, F>, to:D):Bool

Returns true if the outcome is Some and the value is equal to v, otherwise false

staticflatMap<DIn, FIn, DOut, FOut>(o:Outcome<DIn, FIn>, mapper:OutcomeMapper<DIn, FIn, DOut, FOut>):Outcome<DOut, FOut>

Transforms the outcome with a transform function * Different from map, the transform function of flatMap returns an Outcome

staticflatten<D, F>(o:Outcome<Outcome<D, F>, F>):Outcome<D, F>

staticisSuccess<D, F>(outcome:Outcome<D, F>):Bool

Returns true if the outcome is Success

staticmap<A, B, F>(outcome:Outcome<A, F>, transform:A ‑> B):Outcome<B, F>

Transforms the outcome with a transform function * Different from flatMap, the transform function of map returns a plain value

staticnext<T, R>(outcome:Outcome<T, Error>, f:Next<T, R>):Promise<R>

staticor<D, F>(outcome:Outcome<D, F>, fallback:Lazy<D>):D

Extracts the value if the option is Success, uses the fallback value otherwise

staticorNull<D, F>(outcome:Outcome<D, F>):Null<D>

Extracts the value if the option is Success, otherwise null

staticorTry<D, F>(outcome:Outcome<D, F>, fallback:Lazy<Outcome<D, F>>):Outcome<D, F>

Extracts the value if the option is Success, uses the fallback Outcome otherwise

staticinlineorUse<D, F>(outcome:Outcome<D, F>, fallback:Lazy<D>):D

Deprecated: "Use .or() instead"

staticsure<D, F>(outcome:Outcome<D, F>):D

Extracts the value if the outcome is Success, throws the Failure contents otherwise

staticswap<A, B, F>(outcome:Outcome<A, F>, v:B):Outcome<B, F>

Like map but with a plain value instead of a transform function, thus discarding the orginal result

statictoOption<D, F>(outcome:Outcome<D, F>):Option<D>

Creates an Option from this Outcome, discarding the Failure information