MCPcopy Index your code
hub / github.com/nodejs/node / parse

Method parse

deps/minimatch/index.js:1733–1758  ·  view source on GitHub ↗
(pattern)

Source from the content-addressed store, hash-verified

1731 return (0, exports.braceExpand)(this.pattern, this.options);
1732 }
1733 parse(pattern) {
1734 (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
1735 const options = this.options;
1736 if (pattern === "**")
1737 return exports.GLOBSTAR;
1738 if (pattern === "")
1739 return "";
1740 let m;
1741 let fastTest = null;
1742 if (m = pattern.match(starRE)) {
1743 fastTest = options.dot ? starTestDot : starTest;
1744 } else if (m = pattern.match(starDotExtRE)) {
1745 fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
1746 } else if (m = pattern.match(qmarksRE)) {
1747 fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
1748 } else if (m = pattern.match(starDotStarRE)) {
1749 fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
1750 } else if (m = pattern.match(dotStarRE)) {
1751 fastTest = dotStarTest;
1752 }
1753 const re = ast_js_1.AST.fromGlob(pattern, this.options).toMMPattern();
1754 if (fastTest && typeof re === "object") {
1755 Reflect.defineProperty(re, "test", { value: fastTest });
1756 }
1757 return re;
1758 }
1759 makeRe() {
1760 if (this.regexp || this.regexp === false)
1761 return this.regexp;

Callers

nothing calls this directly

Calls 4

toMMPatternMethod · 0.80
matchMethod · 0.65
fromGlobMethod · 0.45
definePropertyMethod · 0.45

Tested by

no test coverage detected