UNPKG

rubico

Version:

[a]synchronous functional programming

9 lines (7 loc) 1.53 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.omit=t}("object"==typeof globalThis?globalThis:this,function(){"use strict";const n=Array.isArray,t=/[.|[|\]]+/,e=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 e=n.length-1,o="["==n[0],r="]"==n[e];return o&&r?n.slice(1,e).split(t):o?n.slice(1).split(t):r?n.slice(0,e).split(t):n.split(t)}),500),o=t=>n(t)?t:"string"==typeof t?e(t):[t],r=function(n,t){if(null==n)return;const e=o(t),r=e.length-1;let c=-1,u=n;for(;++c<r;)if(u=u[e[c]],null==u)return;const l=e[c];null!=u&&l in u&&delete u[l]},c=function(t){const e={};for(const o in t){const r=t[o];n(r)?e[o]=u(r):null!=r&&r.constructor==Object?e[o]=c(r):e[o]=r}return e},u=function(t){const e=t.length,o=[];let r=-1;for(;++r<e;){const e=t[r];n(e)?o[r]=u(e):null!=e&&e.constructor==Object?o[r]=c(e):o[r]=e}return o},l=Symbol.for("placeholder"),i=function(n,t,e){return t==l?((n,t)=>function(e){return n(e,t)})(n,e):((n,t)=>function(e){return n(t,e)})(n,t)},s=function(t,e){const o=e.length,l=n(i=t)?u(i):null==i?i:i.constructor==Object?c(i):i;var i;let s=-1;for(;++s<o;)r(l,e[s]);return l};return function(n,t){return null==t?i(s,l,n):null!=(e=n)&&"function"==typeof e.then?n.then(i(s,l,t)):s(n,t);var e}}());