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

Method match

deps/minimatch/index.js:1830–1872  ·  view source on GitHub ↗
(f, partial = this.partial)

Source from the content-addressed store, hash-verified

1828 }
1829 }
1830 match(f, partial = this.partial) {
1831 this.debug("match", f, this.pattern);
1832 if (this.comment) {
1833 return false;
1834 }
1835 if (this.empty) {
1836 return f === "";
1837 }
1838 if (f === "/" && partial) {
1839 return true;
1840 }
1841 const options = this.options;
1842 if (this.isWindows) {
1843 f = f.split("\\").join("/");
1844 }
1845 const ff = this.slashSplit(f);
1846 this.debug(this.pattern, "split", ff);
1847 const set = this.set;
1848 this.debug(this.pattern, "set", set);
1849 let filename = ff[ff.length - 1];
1850 if (!filename) {
1851 for (let i = ff.length - 2; !filename && i >= 0; i--) {
1852 filename = ff[i];
1853 }
1854 }
1855 for (const pattern of set) {
1856 let file = ff;
1857 if (options.matchBase && pattern.length === 1) {
1858 file = [filename];
1859 }
1860 const hit = this.matchOne(file, pattern, partial);
1861 if (hit) {
1862 if (options.flipNegate) {
1863 return true;
1864 }
1865 return !this.negate;
1866 }
1867 }
1868 if (options.flipNegate) {
1869 return false;
1870 }
1871 return this.negate;
1872 }
1873 static defaults(def) {
1874 return exports.minimatch.defaults(def).Minimatch;
1875 }

Callers

nothing calls this directly

Calls 5

debugMethod · 0.80
slashSplitMethod · 0.80
matchOneMethod · 0.80
joinMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected