MCPcopy
hub / github.com/SPlayer-Dev/SPlayer / toString

Method toString

src/utils/lyric/lyricParser.ts:539–563  ·  view source on GitHub ↗
(indent = 0)

Source from the content-addressed store, hash-verified

537 }
538
539 toString(indent = 0): string {
540 const spaces = " ".repeat(indent);
541 const attrs = Object.entries(this.attributes)
542 .map(([key, val]) => `${key}="${this.escape(String(val))}"`)
543 .join(" ");
544
545 const attrStr = attrs ? " " + attrs : "";
546
547 if (this.children.length === 0) {
548 return `${spaces}<${this.name}${attrStr} />`;
549 }
550
551 const isAllText = this.children.every((c) => typeof c === "string");
552
553 if (isAllText) {
554 const textContent = this.children.map((c) => this.escape(c as string)).join("");
555 return `${spaces}<${this.name}${attrStr}>${textContent}</${this.name}>`;
556 }
557
558 const childrenStr = this.children
559 .map((c) => (typeof c === "string" ? this.escape(c) : c.toString(indent + 2)))
560 .join("\n");
561
562 return `${spaces}<${this.name}${attrStr}>\n${childrenStr}\n${spaces}</${this.name}>`;
563 }
564}
565
566/**

Callers 15

lyricLinesToTTMLFunction · 0.95
getFileIDFunction · 0.80
createTaskbarLyricWindowFunction · 0.80
createMethod · 0.80
startMethod · 0.80
setupEventListenersMethod · 0.80
b64encodeFunction · 0.80
decryptQrcFunction · 0.80
getRandomDeviceIdFunction · 0.80
LongFunction · 0.80
encryptQueryFunction · 0.80

Calls 1

escapeMethod · 0.95

Tested by

no test coverage detected