Skip to content

martingreilinger/futoo

Repository files navigation

futoo

Build Status

Functional Toolbox written in TypeScript.

Inspired by vavr

Quickstart

Option

 // Possible usage of the Option class to avoid potential null access.
 const someValue: string = 'sample text';

 const valueOption = Option.of(someValue);

 valueOption.constructor.name       // Some
 valueOption.isDefined();           // true
 valueOption.getOrElse('other');    // 'sample text'
 valueOption.get();                 // 'sample text'

 const nullValue: number = null;

 const nullValueOption = Option.of(nullValue);

 nullValueOption.constructor.name   // None
 nullValueOption.isEmpty();         // true
 nullValueOption.getOrElse(42);     // 42
 nullValueOption.get();             // throws new Error('No value present')

Work in progress

About

Functional Toolbox written in TypeScript

Resources

License

Stars

Watchers

Forks

Packages

No packages published