MCPcopy Create free account
hub / github.com/marijnh/Eloquent-JavaScript / verify

Function verify

code/solutions/09_1_regexp_golf.js:32–41  ·  view source on GitHub ↗
(regexp, yes, no)

Source from the content-addressed store, hash-verified

30
31
32function verify(regexp, yes, no) {
33 // Ignore unfinished exercises
34 if (regexp.source == "...") return;
35 for (let str of yes) if (!regexp.test(str)) {
36 console.log(`Failure to match '${str}'`);
37 }
38 for (let str of no) if (regexp.test(str)) {
39 console.log(`Unexpected match for '${str}'`);
40 }
41}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected