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

Method #addSubpattern

lib/internal/fs/glob.js:465–493  ·  view source on GitHub ↗
(path, pattern)

Source from the content-addressed store, hash-verified

463 return real !== null && pattern.realpaths.has(real);
464 }
465 #addSubpattern(path, pattern) {
466 if (this.#isExcluded(path)) {
467 return;
468 }
469 const fullpath = resolve(this.#root, path);
470
471 // If path is a directory, add trailing slash and test patterns again.
472 if (this.#isExcluded(`${fullpath}/`) && this.#cache.statSync(fullpath).isDirectory()) {
473 return;
474 }
475
476 if (this.#exclude) {
477 if (this.#withFileTypes) {
478 const stat = this.#cache.statSync(path);
479 if (stat !== null) {
480 if (this.#exclude(stat)) {
481 return;
482 }
483 }
484 } else if (this.#exclude(path)) {
485 return;
486 }
487 }
488 if (!this.#subpatterns.has(path)) {
489 this.#subpatterns.set(path, [pattern]);
490 } else {
491 ArrayPrototypePush(this.#subpatterns.get(path), pattern);
492 }
493 }
494 #addSubpatterns(path, pattern) {
495 const seen = this.#cache.add(path, pattern);
496 if (seen) {

Callers 2

#addSubpatternsMethod · 0.95
#iterateSubpatternsMethod · 0.95

Calls 6

hasMethod · 0.65
getMethod · 0.65
resolveFunction · 0.50
isDirectoryMethod · 0.45
statSyncMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected