diff options
author | elioat <elioat@tilde.institute> | 2024-08-20 11:37:14 -0400 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2024-08-20 11:37:14 -0400 |
commit | 8b0f342808ce24c11994a9551c0326b9c775c93c (patch) | |
tree | 4ab3be959c6a5b30894ae4e57dad278e1cde356e /js | |
parent | c27d24ab1109b94720deb03dea68d1779e7f807d (diff) | |
download | tour-8b0f342808ce24c11994a9551c0326b9c775c93c.tar.gz |
*
Diffstat (limited to 'js')
-rw-r--r-- | js/b/b.min.js | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/js/b/b.min.js b/js/b/b.min.js new file mode 100644 index 0000000..0f7aba0 --- /dev/null +++ b/js/b/b.min.js @@ -0,0 +1 @@ +"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)})}};export default b; |