MCPcopy Create free account
hub / github.com/JacobLinCool/LeetCode-Stats-Card / stringify

Method stringify

packages/core/src/item.ts:40–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38 }
39
40 public stringify(): string {
41 if (!this.attr.id) {
42 this.attr.id = `_${(++counter).toString(36)}`;
43 }
44 const attr = Object.entries(this.attr)
45 .map(
46 ([key, value]) =>
47 `${key}="${escape(Array.isArray(value) ? value.join(" ") : value.toString())}"`,
48 )
49 .join(" ");
50 const children = this.children?.map((child) => child.stringify()).join("") || "";
51 return this.single
52 ? `<${this.type} ${attr} />`
53 : `<${this.type} ${attr}>${this.content ? escape(this.content) : ""}${children}</${this.type}>`;
54 }
55
56 public css(): string {
57 if (!this.attr.id) {

Callers 4

_fetchMethod · 0.80
hydrateMethod · 0.80
elements.test.tsFile · 0.80
generateFunction · 0.80

Calls 1

escapeFunction · 0.85

Tested by

no test coverage detected