UNPKG

rubico

Version:

[a]synchronous functional programming

9 lines (7 loc) 1.02 kB
/** * 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(n,t){"object"==typeof module?module.exports=t:"function"==typeof define?define((()=>t)):n.not=t}("object"==typeof globalThis?globalThis:this,function(){"use strict";const n=Array.isArray,t=n=>null!=n&&"function"==typeof n.then,o=Promise.all.bind(Promise),e=Symbol.for("placeholder"),r=n=>!n,u=function(n,o){const e=o(...n);return t(e)?e.then(r):!e};return function(...r){const i=r.pop();return"function"==typeof i?0==r.length?(f=u,l=i,(c=e)==e?((n,t)=>function(...o){return n(o,t)})(f,l):((n,t)=>function(...o){return n(t,o)})(f,c)):function(o){if(n(o)){const n=o.length;let e=-1;for(;++e<n;){const n=o[e];if(t(n))return!0}return!1}for(const n in o){const e=o[n];if(t(e))return!0}return!1}(r)?o(r).then(function(n,t,o){return t==e?((n,t)=>function(o){return n(o,t)})(n,o):((n,t)=>function(o){return n(t,o)})(n,t)}(u,e,i)):u(r,i):!i;var f,c,l}}());