MCPcopy
hub / github.com/webpack/webpack / joinExplicitNewLine

Function joinExplicitNewLine

lib/stats/DefaultStatsPrinterPlugin.js:1284–1303  ·  view source on GitHub ↗
(items, indenter)

Source from the content-addressed store, hash-verified

1282 * @returns {string} result
1283 */
1284const joinExplicitNewLine = (items, indenter) => {
1285 let firstInLine = true;
1286 let first = true;
1287 return items
1288 .map((item) => {
1289 if (!item || !item.content) return;
1290 let content = indent(item.content, first ? "" : indenter, !firstInLine);
1291 if (firstInLine) {
1292 content = content.replace(/^\n+/, "");
1293 }
1294 if (!content) return;
1295 first = false;
1296 const noJoiner = firstInLine || content.startsWith("\n");
1297 firstInLine = content.endsWith("\n");
1298 return noJoiner ? content : ` ${content}`;
1299 })
1300 .filter(Boolean)
1301 .join("")
1302 .trim();
1303};
1304
1305/**
1306 * Returns joiner.

Callers 2

joinErrorFunction · 0.85

Calls 2

indentFunction · 0.70
replaceMethod · 0.45

Tested by

no test coverage detected