MCPcopy Create free account
hub / github.com/nodejs/node / globSync

Method globSync

lib/internal/fs/glob.js:383–402  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

381 }
382
383 globSync() {
384 ArrayPrototypePush(this.#queue, { __proto__: null, path: '.', patterns: this.#patterns });
385 while (this.#queue.length > 0) {
386 const item = ArrayPrototypePop(this.#queue);
387 for (let i = 0; i < item.patterns.length; i++) {
388 this.#addSubpatterns(item.path, item.patterns[i]);
389 }
390 this.#subpatterns
391 .forEach((patterns, path) => ArrayPrototypePush(this.#queue, { __proto__: null, path, patterns }));
392 this.#subpatterns.clear();
393 }
394 return ArrayFrom(
395 this.#results,
396 this.#withFileTypes ? (path) => this.#cache.statSync(
397 isAbsolute(path) ?
398 path :
399 join(this.#root, path),
400 ) : undefined,
401 );
402 }
403 #isDirectorySync(path, stat, pattern) {
404 if (stat?.isDirectory()) {
405 return true;

Callers 2

createTestFileListFunction · 0.95
globSyncFunction · 0.80

Calls 6

#addSubpatternsMethod · 0.95
isAbsoluteFunction · 0.85
joinFunction · 0.70
forEachMethod · 0.65
clearMethod · 0.65
statSyncMethod · 0.45

Tested by

no test coverage detected