UNPKG

rubico

Version:

[a]synchronous functional programming

9 lines (7 loc) 1.28 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.get=t}("object"==typeof globalThis?globalThis:this,function(){"use strict";const n=Symbol.for("placeholder"),t=function(t,e,o,r){return e==n?((n,t,e)=>function(o){return n(o,t,e)})(t,o,r):o==n?((n,t,e)=>function(o){return n(t,o,e)})(t,e,r):((n,t,e)=>function(o){return n(t,e,o)})(t,e,o)},e=Array.isArray,o=/[.|[|\]]+/,r=function(n,t){const e=new Map,o=function(o){if(e.has(o))return e.get(o);const r=n(o);return e.set(o,r),e.size>t&&e.clear(),r};return o.cache=e,o}((function(n){const t=n.length-1,e="["==n[0],r="]"==n[t];return e&&r?n.slice(1,t).split(o):e?n.slice(1).split(o):r?n.slice(0,t).split(o):n.split(o)}),500),i=function(n,t){const o=(n=>e(n)?n:"string"==typeof n?r(n):[n])(t),i=o.length;let u=-1,c=n;for(;++u<i;)if(c=c[o[u]],null==c)return;return c},u=function(n,t,e){const o=null==n?void 0:i(n,t);return void 0===o?"function"==typeof e?e(n):e:o};return function(o,r,i){return"string"==typeof o||"number"==typeof o||e(o)?t(u,n,o,r):null!=(c=o)&&"function"==typeof c.then?o.then(t(u,n,r,i)):u(o,r,i);var c}}());