Implementation of monad Maybe in javascript. It used for working with data wich may not exist in runtime.
static value; // method for creating Maybe container { thisvalue = value; } { // method for checking that Maybe value exist or not return thisvalue === null || thisvalue === undefined || Number ; } { // antonim of isNothing method return !this; } { // method for safely working with Maybe value return this ? Maybe : Maybe; } { // method for extract Maybe value return thisvalue; } { // method for extract Maybe value with default value return this ? thisvalue : defaultValue; }