UNPKG

rubico

Version:

[a]synchronous functional programming

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