MCPcopy
hub / github.com/webpack/webpack / normalize

Function normalize

test/Defaults.unittest.js:35–47  ·  test/Defaults.unittest.js::normalize
(str)

Source from the content-addressed store, hash-verified

33 * @returns {string} normalized string
34 */
35const normalize = (str) => {
36 if (cwd.startsWith(class="st">"/")) {
37 str = str.replace(new RegExp(quoteMeta(cwd), class="st">"g"), class="st">"<cwd>");
38 } else {
39 str = str.replace(cwdRegExp, (m, g) => `<cwd>${g.replace(/\\/g, class="st">"/")}`);
40 str = str.replace(
41 escapedCwdRegExp,
42 (m, g) => `<cwd>${g.replace(/\\\\/g, class="st">"/")}`
43 );
44 }
45 str = str.replace(/@@ -\d+,\d+ \+\d+,\d+ @@/g, class="st">"@@ ... @@");
46 return str;
47};
48
49class Diff {
50 /**

Callers 1

printFunction · 0.70

Calls 2

quoteMetaFunction · 0.70
replaceMethod · 0.45

Tested by

no test coverage detected