MCPcopy Create free account
hub / github.com/marijnh/Eloquent-JavaScript / escapeIndexChar

Function escapeIndexChar

src/render_latex.mjs:49–62  ·  view source on GitHub ↗
(ch)

Source from the content-addressed store, hash-verified

47}
48
49function escapeIndexChar(ch) {
50 switch (ch) {
51 case "~": return "\\textasciitilde "
52 case "^": return "\\textasciicircum "
53 case "\\": return "\\textbackslash "
54 case "|": return "\\textbar{} "
55 case "@": return "\"@"
56 case "!": return "\"!"
57 case "- ": return "-@− "
58 case "--": return "--@−−"
59 case "-=": return "-=@−="
60 default: return "\\" + ch
61 }
62}
63function escapeIndex(value) {
64 if (Array.isArray(value)) return value.map(escapeIndex).join("!")
65 return String(value).replace(/[&%$#_{}~^\\|!@]|-[ -=]/g, escapeIndexChar)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected