rubico
Version:
[a]synchronous functional programming
9 lines (7 loc) • 905 B
JavaScript
/**
* rubico v2.6.2
* https://github.com/a-synchronous/rubico
* (c) 2019-2024 Richard Tong
* rubico may be freely distributed under the MIT license.
*/
!function(t,n){"object"==typeof module?module.exports=n:"function"==typeof define?define((()=>n)):t.curry=n}("object"==typeof globalThis?globalThis:this,function(){"use strict";const t=Symbol.for("placeholder"),n=(n,o,r)=>function(...u){const f=r.length,i=u.length,l=[];let c=-1,s=-1,h=0;for(;++c<f;){const f=r[c];if(f==t&&(s+=1)<i){const n=u[s];n==t&&(h+=1),l.push(n)}else l.push(f);if(l.length==n)return 0==h?o(...l):e(n,o,l)}for(;++s<i;){const r=u[s];if(r==t&&(h+=1),l.push(r),l.length==n)return 0==h?o(...l):e(n,o,l)}return e(n,o,l)},e=function(e,o,r){const u=r.length;if(u<e)return n(e,o,r);let f=-1;for(;++f<u;){if(r[f]==t)return n(e,o,r)}return o(...r)},o=(t,...n)=>e(t.length,t,n);return o.arity=function(t,n,...o){return e(t,n,o)},o}());