MCPcopy Create free account
hub / github.com/alignoth/alignoth / k

Function k

resources/vega-embed.min.js:609–654  ·  view source on GitHub ↗
(e, t = {})

Source from the content-addressed store, hash-verified

607 });
608 const F = /("(?:[^\\"]|\\.)*")|[:,]/g;
609 function k(e, t = {}) {
610 const n = JSON.stringify(
611 [1],
612 void 0,
613 void 0 === t.indent ? 2 : t.indent,
614 ).slice(2, -3),
615 r = "" === n ? 1 / 0 : void 0 === t.maxLength ? 80 : t.maxLength;
616 let { replacer: i } = t;
617 return (function e(t, o, a) {
618 t && "function" == typeof t.toJSON && (t = t.toJSON());
619 const s = JSON.stringify(t, i);
620 if (void 0 === s) return s;
621 const l = r - o.length - a;
622 if (s.length <= l) {
623 const e = s.replace(F, (e, t) => t || `${e} `);
624 if (e.length <= l) return e;
625 }
626 if (
627 (null != i && ((t = JSON.parse(s)), (i = void 0)),
628 "object" == typeof t && null !== t)
629 ) {
630 const r = o + n,
631 i = [];
632 let a,
633 s,
634 l = 0;
635 if (Array.isArray(t)) {
636 ((a = "["), (s = "]"));
637 const { length: n } = t;
638 for (; l < n; l++) i.push(e(t[l], r, l === n - 1 ? 0 : 1) || "null");
639 } else {
640 ((a = "{"), (s = "}"));
641 const n = Object.keys(t),
642 { length: o } = n;
643 for (; l < o; l++) {
644 const a = n[l],
645 s = `${JSON.stringify(a)}: `,
646 c = e(t[a], r, s.length + (l === o - 1 ? 0 : 1));
647 void 0 !== c && i.push(s + c);
648 }
649 }
650 if (i.length > 0) return [a, n + i.join(`,\n${r}`), s].join(`\n${o}`);
651 }
652 return s;
653 })(e, "", 0);
654 }
655 function _(e) {
656 return e &&
657 e.__esModule &&

Callers 1

InFunction · 0.70

Calls 3

eFunction · 0.85
toJSONMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected