UNPKG

ts-utls

Version:

Utilities for TypeScript library

28 lines 1.17 kB
import { Maybe } from '..'; export interface Either<E, T> { ap<V>(eitherFn: Either<E, (val: T) => V>): Either<E, V>; bind<V>(fn: (val: T) => Either<E, V>): Either<E, V>; flatMap<V>(fn: (val: T) => Either<E, V>): Either<E, V>; chain<V>(fn: (val: T) => Either<E, V>): Either<E, V>; join<V>(): Either<E, V>; map<V>(fn: (val: T) => V): Either<E, V>; takeLeft(m: Either<E, T>): Either<E, T>; takeRight(m: Either<E, T>): Either<E, T>; cata<Z>(leftFn: (err: E) => Z, rightFn: (val: T) => Z): Z; equals(other: Either<E, T>): boolean; fold<Z>(leftFn: (err: E) => Z, rightFn: (val: T) => Z): Z; leftMap<F>(fn: (leftVal: E) => F): Either<F, T>; swap(): Either<T, E>; isLeft(): boolean; isRight(): boolean; left(): E; right(): T; forEach(fn: (val: T) => void): void; forEachLeft(fn: (val: E) => void): void; toMaybe(): Maybe<T>; toPromise(): Promise<T>; } export declare const Either: <E, T>(val: T, isRightValue: boolean) => Either<E, T>; export declare const Left: <E, T>(val: E) => Either<E, T>; export declare const Right: <E, T>(val: T) => Either<E, T>; //# sourceMappingURL=either.d.ts.map