README
Little Monad That Could
Simple null-safe monad for handling singular values as well as arrays.
Installation
Module can be easily installed with NPM:
npm install --save little-monad-that-could
Usage
Simply require it in your code:
const { when, pipe, get, filter } = require('little-monad-that-could');
const life = { life: 42 }
const universe = value => value + 12
const everything = value => value === 6 * 9
when(life)
.get('life')
.map(universe)
.filter(everything)
.otherwise(0)
const compute = pipe(
get('life'),
universe,
filter(everything))
compute(life).otherwise(0)