MCPcopy Index your code
hub / github.com/prettier/prettier / normalizeName

Function normalizeName

src/language-html/parse/postprocess.js:222–249  ·  view source on GitHub ↗
(node, parseOptions)

Source from the content-addressed store, hash-verified

220}
221
222function normalizeName(node, parseOptions) {
223 if (node.kind === "element") {
224 if (
225 parseOptions.normalizeTagName &&
226 (!node.namespace ||
227 node.namespace === node.tagDefinition.implicitNamespacePrefix ||
228 isUnknownNamespace(node))
229 ) {
230 node.name = lowerCaseIf(node.name, (lowerCasedName) =>
231 HTML_TAGS.has(lowerCasedName),
232 );
233 }
234
235 if (parseOptions.normalizeAttributeName) {
236 for (const attr of node.attrs) {
237 if (!attr.namespace) {
238 attr.name = lowerCaseIf(
239 attr.name,
240 (lowerCasedAttrName) =>
241 HTML_ELEMENT_ATTRIBUTES.has(node.name) &&
242 (HTML_ELEMENT_ATTRIBUTES.get("*").has(lowerCasedAttrName) ||
243 HTML_ELEMENT_ATTRIBUTES.get(node.name).has(lowerCasedAttrName)),
244 );
245 }
246 }
247 }
248 }
249}
250
251export { postprocess };

Callers 1

visitMethod · 0.85

Calls 3

isUnknownNamespaceFunction · 0.85
lowerCaseIfFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…