MCPcopy
hub / github.com/webpack/webpack / check

Function check

test/checkArrayExpectation.js:94–108  ·  view source on GitHub ↗
(expected, actual)

Source from the content-addressed store, hash-verified

92 * @returns {boolean} whether actual matches expected
93 */
94const check = (expected, actual) => {
95 if (expected instanceof RegExp) {
96 expected = { message: expected };
97 }
98 if (Array.isArray(expected)) {
99 return expected.every((e) => check(e, actual));
100 }
101 return Object.keys(expected).every((key) => {
102 let value = actual[key];
103 if (typeof value === "object") {
104 value = JSON.stringify(value);
105 }
106 return expected[key].test(value);
107 });
108};
109
110/**
111 * @param {EXPECTED_ANY} object stats item or RegExp

Callers 1

diffItemsFunction · 0.70

Calls 3

isArrayMethod · 0.80
keysMethod · 0.65
testMethod · 0.45

Tested by

no test coverage detected