UNPKG

rubico

Version:

[a]synchronous functional programming

9 lines (7 loc) 803 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.thunkify=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,t)=>n(...t);return(i,...f)=>function(){return 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}(f)?o(f).then((u=r,l=e,(c=i)==e?((n,t)=>function(o){return n(o,t)})(u,l):((n,t)=>function(o){return n(t,o)})(u,c))):i(...f);var u,c,l}}());