Licence
MIT
Version
2.0.1
Deps
0
Vulns
0
Weekly
0
@ekz/option
Option/Maybe type for TypeScript — a port of Scala's Option.
Documentation: https://docs.ekz.io/option/
Install
npm install @ekz/option
Quick 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.