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

Method toMMPattern

deps/minimatch/index.js:782–796  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

780 // returns the regular expression if there's magic, or the unescaped
781 // string if not.
782 toMMPattern() {
783 if (this !== this.#root)
784 return this.#root.toMMPattern();
785 const glob = this.toString();
786 const [re, body, hasMagic, uflag] = this.toRegExpSource();
787 const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
788 if (!anyMagic) {
789 return body;
790 }
791 const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
792 return Object.assign(new RegExp(`^${re}$`, flags), {
793 _src: re,
794 _glob: glob
795 });
796 }
797 get options() {
798 return this.#options;
799 }

Callers 1

parseMethod · 0.80

Calls 3

toRegExpSourceMethod · 0.80
assignMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected