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

Function esc

src/generate_epub_toc.mjs:6–8  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

4let [template, ...chapters] = process.argv.slice(2)
5
6function esc(str) {
7 return str.replace(/[<>&"]/g, ch => ch == "<" ? "&lt;" : ch == ">" ? "&gt;" : ch == "&" ? "&amp;" : "&quot;")
8}
9
10let toc = ""
11const section = /<h2\b[^>]*><a [^>]*?id="(h_.*?)".*?><\/a>(.*?)<\/h2>/g

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected