airt / try-t

'try' type in typescript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

try-t

Build Status Test Coverage NPM Version

Try type in Typescript

installation

npm install try-t --save

api

For details, see test/try-spec

Try.failure

Try.failure: <A = never>(error: Error) => Try<A>

Try.success

Try.success: <A>(value: A) => Try<A>

Try.of

Try.of: <A>(f: () => A) => Try<A>

Try.m

Try.m: <A>(f: () => Try<A>) => Try<A>

Try.p

Try.p: <A>(p: Promise<A>) => Promise<Try<A>>

Try#match

match: <B>(matchers: { success: Fn<A, B>, failure: Fn<Error, B> }) => B

Try#isFailure

isFailure: boolean

Try#isSuccess

isSuccess: boolean

Try#get

get: () => A

Try#getOrElse

getOrElse: (other: () => A) => A

Try#orElse

orElse: (other: () => Try<A>) => Try<A>

Try#map

map: <B>(f: Fn<A, B>) => Try<B>

Try#failed

failed: () => Try<Error>

Try#fold

fold: <B>(hf: Fn<Error, B>, hs: Fn<A, B>) => B

Try#filter

filter: (p: Fn<A, boolean>) => Try<A>

Try#flatMap

flatMap: <B>(f: Fn<A, Try<B>>) => Try<B>

Try#foreach

foreach: (f: Fn<A, void>) => void

Try#onFailure

onFailure: (f: Fn<Error, void>) => Try<A>

Try#onSuccess

onSuccess: (f: Fn<A, void>) => Try<A>

Try#transform

transform: <B>(hs: Fn<A, Try<B>>, hf: Fn<Error, Try<B>>) => Try<B>

Try#recover

recover: (f: Fn<Error, A>) => Try<A>

Try#recoverWith

recoverWith: (f: Fn<Error, Try<A>>) => Try<A>

Try#toArray

toArray: () => Array<A>

Try#toJSON

toJSON: () => TryAsJson<A>

Try#toString

toString: () => string

Try#[Symbol.iterator]

[Symbol.iterator]: () => Iterator<A>

references

Try type in Scala

license

MIT

About

'try' type in typescript

License:MIT License


Languages

Language:JavaScript 68.5%Language:TypeScript 31.5%