MCPcopy
hub / github.com/webpack/webpack / explain

Function explain

test/checkArrayExpectation.js:114–131  ·  view source on GitHub ↗
(object)

Source from the content-addressed store, hash-verified

112 * @returns {string} explanation string
113 */
114const explain = (object) => {
115 if (object instanceof RegExp) {
116 object = { message: object };
117 }
118 return Object.keys(object)
119 .map((key) => {
120 let value = object[key];
121 if (typeof value === "object" && !(value instanceof RegExp)) {
122 value = JSON.stringify(value);
123 }
124 let msg = `${key} = ${value}`;
125 if (key !== "stack" && key !== "details" && msg.length > 100) {
126 msg = `${msg.slice(0, 97)}...`;
127 }
128 return msg;
129 })
130 .join("; ");
131};
132
133/**
134 * @param {EXPECTED_ANY[]} actual actual items

Callers 1

diffItemsFunction · 0.85

Calls 2

sliceMethod · 0.80
keysMethod · 0.65

Tested by

no test coverage detected