MCPcopy Create free account
hub / github.com/nodejs/node / #fillNegs

Method #fillNegs

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

Source from the content-addressed store, hash-verified

514 return this.#toString !== void 0 ? this.#toString : !this.type ? this.#toString = this.#parts.map((p) => String(p)).join("") : this.#toString = this.type + "(" + this.#parts.map((p) => String(p)).join("|") + ")";
515 }
516 #fillNegs() {
517 if (this !== this.#root)
518 throw new Error("should only call on root");
519 if (this.#filledNegs)
520 return this;
521 this.toString();
522 this.#filledNegs = true;
523 let n;
524 while (n = this.#negs.pop()) {
525 if (n.type !== "!")
526 continue;
527 let p = n;
528 let pp = p.#parent;
529 while (pp) {
530 for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) {
531 for (const part of n.#parts) {
532 if (typeof part === "string") {
533 throw new Error("string part in extglob AST??");
534 }
535 part.copyIn(pp.#parts[i]);
536 }
537 }
538 p = pp;
539 pp = p.#parent;
540 }
541 }
542 return this;
543 }
544 push(...parts) {
545 for (const p of parts) {
546 if (p === "")

Callers 1

toRegExpSourceMethod · 0.80

Calls 3

popMethod · 0.80
copyInMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected