UNPKG

rubico

Version:

[a]synchronous functional programming

10 lines (8 loc) 1.15 kB
/** * Rubico v2.8.2 * https://rubico.land/ * * © Richard Yufei Tong, King of Software * Rubico may be freely distributed under the CFOSS license. */ !function(t,n){"object"==typeof module?module.exports=n:"function"==typeof define?define(()=>n):t.defaultsDeep=n}("object"==typeof globalThis?globalThis:this,function(){"use strict";const t=Array.isArray,n=Symbol.for("placeholder");function o(n,e){const c=e.length,u=n.slice();let l=-1;for(;++l<c;){const c=n[l],s=e[l];t(c)&&t(s)?u[l]=o(c,s):null==c?u[l]=s:null==s?u[l]=c:c.constructor==Object&&s.constructor==Object?u[l]=r(c,s):u[l]=c}return u}function r(n,e){const c={...n};for(const u in e){const l=n[u],s=e[u];t(l)&&t(s)?c[u]=o(l,s):null==l?c[u]=s:null==s?c[u]=l:l.constructor==Object&&s.constructor==Object?c[u]=r(l,s):c[u]=l}return c}function e(n,e){return t(n)&&t(e)?o(n,e):null==n||null==e?n:n.constructor==Object&&e.constructor==Object?r(n,e):n}return function(...t){if(1==t.length)return o=e,r=n,c=t[0],r==n?((t,n)=>function(o){return t(o,n)})(o,c):((t,n)=>function(o){return t(n,o)})(o,r);var o,r,c;if(2==t.length)return e(...t);throw new TypeError("Invalid number of arguments")}}());