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

Function escape

src/render_latex.mjs:42–47  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

40 }
41}
42function escape(str) {
43 return String(str).replace(/[&%$#_{}~^\\"]|\w(\/)\w/g, (match, group) => {
44 if (group) return match[0] + escapeChar(group) + match[2]
45 return escapeChar(match)
46 })
47}
48
49function escapeIndexChar(ch) {
50 switch (ch) {

Callers 3

textFunction · 0.70
code_inlineFunction · 0.70
meta_quote_closeFunction · 0.70

Calls 1

escapeCharFunction · 0.70

Tested by

no test coverage detected