MCPcopy Create free account
hub / github.com/nodejs/node-addon-api / matchWildCards

Function matchWildCards

unit-test/matchModules.js:18–36  ·  view source on GitHub ↗

* @param filterCondition * matches all given wildcards with available test modules to generate an elaborate filter condition

(filterCondition)

Source from the content-addressed store, hash-verified

16 * matches all given wildcards with available test modules to generate an elaborate filter condition
17 */
18function matchWildCards (filterCondition) {
19 const conditions = filterCondition.split(' ').length ? filterCondition.split(' ') : [filterCondition];
20 const matches = [];
21
22 for (const filter of conditions) {
23 if (isWildcard(filter)) {
24 const matchedDirs = Object.keys(buildDirs).filter(e => filterBy(filter, e));
25 if (matchedDirs.length) {
26 matches.push(matchedDirs.join(' '));
27 }
28 const matchedModules = Object.keys(buildFiles).filter(e => filterBy(filter, e));
29 if (matchedModules.length) { matches.push(matchedModules.join(' ')); }
30 } else {
31 matches.push(filter);
32 }
33 }
34
35 return matches.join(' ');
36}
37
38module.exports.matchWildCards = matchWildCards;
39

Callers 1

matchModules.jsFile · 0.85

Calls 2

isWildcardFunction · 0.85
filterByFunction · 0.85

Tested by

no test coverage detected