From 4a2fc7ca49684af4e4787c714279a2ff144a7cff Mon Sep 17 00:00:00 2001 From: Alex LaFroscia Date: Tue, 26 Jul 2016 15:45:23 -0700 Subject: [PATCH] Prune ignored paths earlier to save unnecessary work --- index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 3a46174..4552f4a 100644 --- a/index.js +++ b/index.js @@ -64,6 +64,11 @@ function _walkSync(baseDir, options, _relativePath) { var names = fs.readdirSync(baseDir + '/' + relativePath); var entries = names.map(function (name) { var entryRelativePath = relativePath + name; + + if (ignoreMatcher && ignoreMatcher.match(entryRelativePath)) { + return; + } + var fullPath = baseDir + '/' + entryRelativePath; var stats = getStat(fullPath); @@ -89,9 +94,6 @@ function _walkSync(baseDir, options, _relativePath) { for (var i=0; i