poplar-annotation
Version:
web-based annotation tool for natural language processing (NLP) needs, inspired by brat rapid annotation tool.
15 lines (14 loc) • 558 B
TypeScript
export declare class Option<T> {
private value;
constructor(value: T | null);
get isSome(): boolean;
map<U>(func: (from: T) => U): Option<U>;
flatMap<U>(func: (from: T) => Option<U>): Option<U>;
orElse(defaultValue: T): T;
toNullable(): T | null;
match<U>(whenSome: U, whenNone: U): U;
}
export declare const none: Option<any>;
export declare function some<T>(value: T): Option<T>;
export declare function fromNullable<T>(value: T | undefined | null): Option<T>;
export declare function fromTry<T>(value: () => T): Option<T>;