MCPcopy
hub / github.com/prettier/prettier / restoreName

Function restoreName

src/language-html/parse/postprocess.js:136–152  ·  view source on GitHub ↗

* @param {Ast.Attribute | Ast.Element} node

(node)

Source from the content-addressed store, hash-verified

134 * @param {Ast.Attribute | Ast.Element} node
135 */
136function restoreName(node) {
137 const namespace = node.name.startsWith(":")
138 ? node.name.slice(1).split(":", 1)[0]
139 : null;
140 const rawName = node.nameSpan.toString();
141 const hasExplicitNamespace =
142 namespace !== null && rawName.startsWith(`${namespace}:`);
143 const name = hasExplicitNamespace
144 ? rawName.slice(namespace.length + 1)
145 : rawName;
146
147 node.name = name;
148 // @ts-expect-error -- expected
149 node.namespace = namespace;
150 // @ts-expect-error -- expected
151 node.hasExplicitNamespace = hasExplicitNamespace;
152}
153
154/**
155 * @param {Ast.Node} node

Callers 1

restoreNameAndValueFunction · 0.85

Calls 2

splitMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…