0.1.2 • Published 5 years ago
simpleemaybee v0.1.2
simpleemaybee
simpleemaybee
can help you with optional arguments, error handling, and records with optional fields.
installation
$ yarn add simpleemaybee
usage
create
const j = just(10);
const n = nothing();
fromNullable(10); // just(10)
fromNullable(null); // nothing()
type guard
isJust(j); // true
isNothing(n); // true
function
const double = (n: number) => n * 2;
map(double)(j); // just(20)
map(double)(n); // nothing()