_(losand)._
_(losand)._ is a monad imprementation on any Javascript
CTE is more likely about it!
New version is here!Usage
node
npm install losand
const _ =
worker
ex. inside ./lib subfolder
browser
//joinjoina === 1_a === 1 //map f(t1, t2)const t1 = a: 1const t2 = b: 2 _ === t1t1b === 2 //fit f(t2, t1)_ === t2t2a === 1 /* Monad Rows */const a = a: 1const k = const h = const m = /*** Left Identity*/ // map <- bind_a === _a// fit <- linklinkk_a === _a /*** Right Identity*/ // map <- bind_a === _a// fit <- linklink__a === _a /*** Associativity*/ // map <- bind_a === _a// fit <- linklink linkh_a === linkklinkh_a // cash_ // 8re_ // 3 _ // 2re_ // {b: 2} // $ methods Chainable method// ex1._b === 10 // ex2. (prototype chain's method can work)_b === 10 // $$ have been chainable IO_b === 10 //by return constructorby_ === Objectby_ === Array //is check type and after return it_ // {a: 1}_ // undefinedre_ // {a: 1} //isnt mismatch type and after return it_ // {a: 1}_ // undefinedre_ // {a: 1} //be is a passing test function_ === 3_ === undefined //fullen check all value isn't undefined or nullfullen === falsefullen === falsefullen === truefullen === falsefullen === falsefullen === true //keyskeys_0 === "r" //valsvals_0 === 128 //get_ === 3_ === undefined //set_ // {a: {b: {c: 8}}}_ // {c: {b: {a: 4}}} //been present methods and properties settings on wrapped Object'sconst BT = _ been_ === 12beento // return to _(_(new BT(3)).been.a(3).b(3).c(3)._)been_ // BT{v: 5, d: {e: 3}, e: 3} //draw is wrapped Object assign from argumentate Object //cast is wrapped Object assign to argumentate Object //hold on wrapped Object from arguments and other object have same inheritance_ // {a: 13, c: 51} //crop out of wrapped Object from arguments and other object have same inheritance_ // {b: 24, d: 40} //pick up wrapped Array to argument Object and other object have same inheritance_ // {a: 13, c: 51} //drop out wrapped Array from argument Object and other object have same inheritance_ // {b: 24, d: 40} //turn is turn to key value pairingturn_ // {a: 0, b: 1, c: 2} /*relate is pairing two Objects but each Objects have no property and no inheritance andswap is call _().relate paired Object another one*/swap_c === undefinedswap_d === 23swapswap_c === 14swapswap_d === undefined swap_c === 14 //list list // [1, 35, 24] //define is Object.defineProperties on wrapped Object_defined === 123 //create is create a new Object inherit on wrapped ObjectObject === a //other is create same inherit Object_constructorprototype === aconstructorprototype //depend is create a new Object inherit on argumentate ObjectObject === a //.give is a iterator of wrapped Object to apply on argumentate function //json get JSONStringjson === JSON //[].each2 3 4 //[].aMap is ApplicativeMap method on Both Way v + 2 v * 2 // [3, 4, 5, 2, 4, 6]1 2 3 // [3, 4, 5, 2, 4, 6] //[].adapt fill gapes like Array.prototype.shift()2 3 4 undefined 6 null // [2, 3, 4, 5, 6, 7] //[].adaptRight fill gapes like Array.prototype.pop()2 3 4 undefined 6 null // [2, 3, 4, 5, 6, 7] //Generate Sequence Array//x._(lim, step = 1) likely [x ... lim]2 ;2 ; //String.prototype.json get _(parsed_object)jsonjson_a === 3 //.from map in prototypefrom_ === Objectprototype //.affix write up prototype object on constructorfrom_a === 3 //.annex define properties mapping prototype object on constructorfrom_b === 5 //.fork inherit on constructorObject === Arrayprototype; //.hybrid intterupt inhert on constructorObject === Arrayprototype; //.part is patial applying34_===3 4_===_=== x + y * z3 2 4_ //.cache presence delay and forcere_ === 20 //.recache presence delay and force mutate cached valuere_ === 56 //.apply applying functions_ === 60
Event driven development
const EETest = _ const eeTest = //addLitener //addOnce //Example with Promise const promise = { ;}