MCPcopy Index your code
hub / github.com/nodejs/node / #flatten

Method #flatten

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

Source from the content-addressed store, hash-verified

945 ];
946 }
947 #flatten() {
948 if (!isExtglobAST(this)) {
949 for (const p of this.#parts) {
950 if (typeof p === "object") {
951 p.#flatten();
952 }
953 }
954 } else {
955 let iterations = 0;
956 let done = false;
957 do {
958 done = true;
959 for (let i = 0; i < this.#parts.length; i++) {
960 const c = this.#parts[i];
961 if (typeof c === "object") {
962 c.#flatten();
963 if (this.#canAdopt(c)) {
964 done = false;
965 this.#adopt(c, i);
966 } else if (this.#canAdoptWithSpace(c)) {
967 done = false;
968 this.#adoptWithSpace(c, i);
969 } else if (this.#canUsurp(c)) {
970 done = false;
971 this.#usurp(c);
972 }
973 }
974 }
975 } while (!done && ++iterations < 10);
976 }
977 this.#toString = void 0;
978 }
979 #partsToRegExp(dot) {
980 return this.#parts.map((p) => {
981 if (typeof p === "string") {

Callers 1

toRegExpSourceMethod · 0.80

Calls 7

isExtglobASTFunction · 0.85
#canAdoptMethod · 0.80
#adoptMethod · 0.80
#canAdoptWithSpaceMethod · 0.80
#adoptWithSpaceMethod · 0.80
#canUsurpMethod · 0.80
#usurpMethod · 0.80

Tested by

no test coverage detected