diff options
-rw-r--r-- | js/b.min.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/js/b.min.js b/js/b.min.js index 1a5647b..c94132e 100644 --- a/js/b.min.js +++ b/js/b.min.js @@ -1 +1,4 @@ -'use strict';const b={pipe:(...args)=>args.reduce((acc,el)=>el(acc)),compose:(...fns)=>(...args)=>fns.reduceRight((res,fn)=>[fn.call(null,...res)],args)[0],identity:x=>x,curry:(fn)=>{const curried=(...args)=>{if(args.length>=fn.length){return fn(...args)}else{return(...rest)=>curried(...args,...rest)}}return curried},match:()=>b.curry((what,s)=>s.match(what)),replace:()=>b.curry((what,replacement,s)=>s.replace(what,replacement)),filter:()=>b.curry((f,xs)=>xs.filter(f)),map:()=>b.curry((f,xs)=>xs.map(f)),deepMap:()=>b.curry(function deepMap(f,xs){return Array.isArray(xs)?xs.map((x)=>deepMap(f,x)):f(xs)})}; \ No newline at end of file +// eli_oat +// docs available in the unminified version +// https://eli.li/_assets/bin/b.js +'use strict';const b={curry:function(fn){const curried=(...args)=>{if(args.length>=fn.length){return fn(...args)}else{return(...rest)=>curried(...args,...rest)}}return curried},pipe:(...fns)=>(value)=>fns.reduce((acc,fn)=>fn(acc),value),compose:(...fns)=>(...args)=>fns.reduceRight((res,fn)=>fn(...[].concat(res)),args),identity:x=>x,match:function(){return this.curry((what,s)=>s.match(what))},replace:function(){return this.curry((what,replacement,s)=>s.replace(what,replacement))},filter:function(){return this.curry((f,xs)=>xs.filter(f))},map:function(){return this.curry((f,xs)=>xs.map(f))},deepMap:function(){return this.curry(function deepMap(f,xs){return Array.isArray(xs)?xs.map((x)=>deepMap(f,x)):f(xs)})}}; \ No newline at end of file |