little-monad-that-could

1.1.2 • Public • Published

Little Monad That Could

NPM

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)

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i little-monad-that-could

      Weekly Downloads

      1

      Version

      1.1.2

      License

      ISC

      Unpacked Size

      2.8 kB

      Total Files

      3

      Last publish

      Collaborators

      • pulverturm