webhook-action/node_modules/flatted/es.js

3 lines
1.1 KiB
JavaScript
Raw Normal View History

self.Flatted=function(t){"use strict";
/*! (c) 2020 Andrea Giammarchi */const{parse:e,stringify:n}=JSON,{keys:r}=Object,s=String,c="string",l={},o="object",a=(t,e)=>e,i=t=>t instanceof s?s(t):t,f=(t,e)=>typeof e===c?new s(e):e,u=(t,e,n,c)=>{const a=[];for(let i=r(n),{length:f}=i,u=0;u<f;u++){const r=i[u],f=n[r];if(f instanceof s){const s=t[f];typeof s!==o||e.has(s)?n[r]=c.call(n,r,s):(e.add(s),n[r]=l,a.push({k:r,a:[t,e,s,c]}))}else n[r]!==l&&(n[r]=c.call(n,r,f))}for(let{length:t}=a,e=0;e<t;e++){const{k:t,a:r}=a[e];n[t]=c.call(n,t,u.apply(null,r))}return n},p=(t,e,n)=>{const r=s(e.push(n)-1);return t.set(n,r),r};return t.parse=(t,n)=>{const r=e(t,f).map(i),s=r[0],c=n||a,l=typeof s===o&&s?u(r,new Set,s,c):s;return c.call({"":l},"",l)},t.stringify=(t,e,r)=>{const s=e&&typeof e===o?(t,n)=>""===t||-1<e.indexOf(t)?n:void 0:e||a,l=new Map,i=[],f=[];let u=+p(l,i,s.call({"":t},"",t)),y=!u;for(;u<i.length;)y=!0,f[u]=n(i[u++],g,r);return"["+f.join(",")+"]";function g(t,e){if(y)return y=!y,e;const n=s.call(this,t,e);switch(typeof n){case o:if(null===n)return n;case c:return l.get(n)||p(l,i,n)}return n}},t}({});