MCPcopy
hub / github.com/prettier/prettier / replaceEndOfLine

Function replaceEndOfLine

src/document/utilities/index.js:363–369  ·  view source on GitHub ↗

@param {Doc} doc @param {Doc} [replacement] @returns {Doc}

(doc, replacement = literalline)

Source from the content-addressed store, hash-verified

361@returns {Doc}
362*/
363function replaceEndOfLine(doc, replacement = literalline) {
364 return mapDoc(doc, (currentDoc) =>
365 typeof currentDoc === "string"
366 ? join(replacement, currentDoc.split("\n"))
367 : currentDoc,
368 );
369}
370
371function canBreakFn(doc) {
372 if (doc.type === DOC_TYPE_LINE) {

Callers 15

genericPrintFunction · 0.90
getTextValuePartsFunction · 0.90
printAttributesFunction · 0.90
printElementFunction · 0.90
printStartTagCommentFunction · 0.90
printChildFunction · 0.90
genericPrintFunction · 0.90
genericPrintFunction · 0.90
embedFunction · 0.90
printMdastFunction · 0.90
printFunction · 0.90

Calls 3

joinFunction · 0.90
mapDocFunction · 0.85
splitMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…