MCPcopy
hub / github.com/prettier/prettier / createAttributePrinter

Function createAttributePrinter

src/language-html/embed/attribute.js:58–72  ·  view source on GitHub ↗

@param {AttributeValuePrint} printValue @returns {AsyncAttributeValuePrint}

(printValue)

Source from the content-addressed store, hash-verified

56@returns {AsyncAttributeValuePrint}
57*/
58function createAttributePrinter(printValue) {
59 return async (textToDoc, print, path, options) => {
60 let valueDoc = await printValue(textToDoc, print, path, options);
61
62 if (!valueDoc) {
63 return;
64 }
65
66 valueDoc = mapDoc(valueDoc, (doc) =>
67 typeof doc === "string" ? doc.replaceAll('"', """) : doc,
68 );
69
70 return [path.node.rawName, '="', group(valueDoc), '"'];
71 };
72}
73
74export default printAttribute;

Callers 1

attribute.jsFile · 0.85

Calls 2

mapDocFunction · 0.90
groupFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…