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

Function capitalizeTitle

src/transform.mjs:64–68  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

62const titleCaseSmallWords = "a an the at by for in of on to up and as but with or nor if console.log".split(" ");
63
64function capitalizeTitle(text) {
65 return text.split(" ")
66 .map(word => titleCaseSmallWords.includes(word) ? word : word[0].toUpperCase() + word.slice(1))
67 .join(" ")
68}
69
70function transformInline(tokens, options, prevType) {
71 let capitalize = options.capitalizeTitles && prevType == "heading_open"

Callers 1

transformInlineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected