Try type in Typescript
npm install try-t --save
For details, see test/try-spec
- Try.failure
- Try.success
- Try.of
- Try.m
- Try.p
- Try#match
- Try#isFailure
- Try#isSuccess
- Try#get
- Try#getOrElse
- Try#orElse
- Try#map
- Try#failed
- Try#fold
- Try#filter
- Try#flatMap
- Try#foreach
- Try#onFailure
- Try#onSuccess
- Try#transform
- Try#recover
- Try#recoverWith
- Try#toArray
- Try#toJSON
- Try#toString
- Try#[Symbol.iterator]
Try.failure: <A = never>(error: Error) => Try<A>
Try.success: <A>(value: A) => Try<A>
Try.of: <A>(f: () => A) => Try<A>
Try.m: <A>(f: () => Try<A>) => Try<A>
Try.p: <A>(p: Promise<A>) => Promise<Try<A>>
match: <B>(matchers: { success: Fn<A, B>, failure: Fn<Error, B> }) => B
isFailure: boolean
isSuccess: boolean
get: () => A
getOrElse: (other: () => A) => A
orElse: (other: () => Try<A>) => Try<A>
map: <B>(f: Fn<A, B>) => Try<B>
failed: () => Try<Error>
fold: <B>(hf: Fn<Error, B>, hs: Fn<A, B>) => B
filter: (p: Fn<A, boolean>) => Try<A>
flatMap: <B>(f: Fn<A, Try<B>>) => Try<B>
foreach: (f: Fn<A, void>) => void
onFailure: (f: Fn<Error, void>) => Try<A>
onSuccess: (f: Fn<A, void>) => Try<A>
transform: <B>(hs: Fn<A, Try<B>>, hf: Fn<Error, Try<B>>) => Try<B>
recover: (f: Fn<Error, A>) => Try<A>
recoverWith: (f: Fn<Error, Try<A>>) => Try<A>
toArray: () => Array<A>
toJSON: () => TryAsJson<A>
toString: () => string
[Symbol.iterator]: () => Iterator<A>
MIT