MCPcopy
hub / github.com/webpack/webpack / cutOffMultilineMessage

Function cutOffMultilineMessage

lib/ErrorHelpers.js:48–60  ·  view source on GitHub ↗
(stack, message)

Source from the content-addressed store, hash-verified

46 * @returns {string} stack trace without the message included
47 */
48const cutOffMultilineMessage = (stack, message) => {
49 const stackSplitByLines = stack.split("\n");
50 const messageSplitByLines = message.split("\n");
51
52 /** @type {string[]} */
53 const result = [];
54
55 for (const [idx, line] of stackSplitByLines.entries()) {
56 if (!line.includes(messageSplitByLines[idx])) result.push(line);
57 }
58
59 return result.join("\n");
60};
61
62/**
63 * Returns stack trace without the message included.

Callers 1

cleanUpWebpackOptionsFunction · 0.85

Calls 3

splitMethod · 0.80
entriesMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected