diff options
author | elioat <elioat@tilde.institute> | 2024-08-20 11:21:43 -0400 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2024-08-20 11:21:43 -0400 |
commit | 31d8690c1cf880a58d0a4bd11ea344c071bcf7f2 (patch) | |
tree | e8f3ba1df63d0eddc6f413797c709cc9e23568a9 | |
parent | a77d273800471549d49de12326819fbb14c0fb59 (diff) | |
download | tour-31d8690c1cf880a58d0a4bd11ea344c071bcf7f2.tar.gz |
*
-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 |