@ekz/option
v2.0.2
Published
Option/Maybe type for TypeScript
Readme
@ekz/option
Option/Maybe type for TypeScript — a port of Scala's Option.
Documentation: https://docs.ekz.io/option/
Install
npm install @ekz/optionQuick example
import { Option, Some, None } from '@ekz/option';
const label = Option.of(maybeName).map((n) => n.trim()).getOrElse(() => 'Anonymous');
Some(1).flatMap((n) => (n > 0 ? Some(n) : None)); // Some(1)See the docs for constructors, transformations, and safe unwrapping.
