MCPcopy Index your code
hub / github.com/bigskysoftware/_hyperscript / toString

Method toString

tools/common/_hyperscript.iife.js:28–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26 }
27 // ----- Debug -----
28 toString() {
29 var cur = this.currentToken();
30 var lines = this.source.split("\n");
31 var lineIdx = cur?.line ? cur.line - 1 : lines.length - 1;
32 var col = cur?.line ? cur.column : 0;
33 var contextLine = lines[lineIdx] || "";
34 var tokenLen = Math.max(1, cur?.value?.length || 1);
35 var gutter = String(lineIdx + 1).length;
36 var out = "Tokens(";
37 out += this.#consumed.filter((t) => t.type !== "WHITESPACE").length + " consumed, ";
38 out += this.#tokens.filter((t) => t.type !== "WHITESPACE").length + " remaining";
39 out += ", line " + (lineIdx + 1) + ")\n";
40 out += " " + String(lineIdx + 1).padStart(gutter) + " | " + contextLine + "\n";
41 out += " ".repeat(gutter + 5) + " ".repeat(col) + "^".repeat(tokenLen);
42 if (cur) out += " " + cur.type + " '" + cur.value + "'";
43 return out;
44 }
45 // ----- Token access -----
46 currentToken() {
47 return this.token(0);

Callers 5

_toHTMLFunction · 0.45
getMethod · 0.45
flushCoverageShardFunction · 0.45
server.jsFile · 0.45

Calls 1

currentTokenMethod · 0.45

Tested by

no test coverage detected