MCPcopy Create free account
hub / github.com/Khan/perseus / stringifyComments

Function stringifyComments

utils/extract-css.js:568–576  ·  view source on GitHub ↗
(commentLines, indentationCount)

Source from the content-addressed store, hash-verified

566};
567
568const stringifyComments = (commentLines, indentationCount) => {
569 const indent = indentation.repeat(indentationCount);
570 const comments = commentLines?.map((line) => line.value.trim()) ?? [];
571 return comments.length === 0
572 ? ""
573 : comments.length === 1
574 ? `${indent}/* ${comments[0]} */${"\n"}`
575 : `${indent}/*${"\n"}${indent} ${comments.join("\n" + indent + " ")}${"\n"}${indent}*/${"\n"}`;
576};
577
578const stringifyCssProperty = (cssProperty, indentationCount = 1) => {
579 const property = `${indentation.repeat(indentationCount)}${cssProperty.property}: ${cssProperty.value};`;

Callers 2

stringifyCssPropertyFunction · 0.85
extract-css.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected