JavaScript Optional type for functional programming with Flow
npm install --save optional-js-flow
import OptionalFactory from 'optional-js-flow';
import type { Optional } from 'optional-js-flow';
OptionalFactory.makeOptionalOf<T>(value: T | null | void): Optional<T>
OptionalFactory.makeEmptyOptional<T>(): Optional<T>
map<U>(map: (value: T) => U): Optional<U>;
orElse(elseValue: T): T;
ifPresent(consume: (value: T) => void): void;
orElseSupplyValue(supplyElseValue: () => T): T;
ifPresentOrElse(consume: (value: T) => void, performAction: () => void): void;
filter(isTrue: (value: T) => boolean): Optional<T>;
flatMap<U>(map: (value: T) => Optional<U>): Optional<U>;
MIT License