diff --git a/lib/internal/fs/glob.js b/lib/internal/fs/glob.js index a20ca9d2b26fb5..def75f85e17bb2 100644 --- a/lib/internal/fs/glob.js +++ b/lib/internal/fs/glob.js @@ -331,10 +331,7 @@ class Glob { const fullpath = resolve(this.#root, path); // If path is a directory, add trailing slash and test patterns again. - // TODO(Trott): Would running #isExcluded() first and checking isDirectory() only - // if it matches be more performant in the typical use case? #isExcluded() - // is often ()=>false which is about as optimizable as a function gets. - if (this.#cache.statSync(fullpath).isDirectory() && this.#isExcluded(`${fullpath}/`)) { + if (this.#isExcluded(`${fullpath}/`) && this.#cache.statSync(fullpath).isDirectory()) { return; }