Skip to content

Commit

Permalink
don't overwrite file parameter, also filePath is clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
edrex committed Feb 29, 2016
1 parent 45ee40e commit 8604eae
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ function readdir(path, ignores, callback) {
}

files.forEach(function(file) {
fs.lstat(p.join(path, file), function(_err, stats) {
var filePath = p.join(path, file)
fs.lstat(filePath, function(_err, stats) {
if (_err) {
return callback(_err)
}

file = p.join(path, file)
if (ignores.some(function(matcher) { return matcher(file, stats) })) {
if (ignores.some(function(matcher) { return matcher(filePath, stats) })) {
pending -= 1
if (!pending) {
return callback(null, list)
Expand All @@ -53,7 +53,7 @@ function readdir(path, ignores, callback) {
}

if (stats.isDirectory()) {
readdir(file, ignores, function(__err, res) {
readdir(filePath, ignores, function(__err, res) {
if (__err) {
return callback(__err)
}
Expand All @@ -65,7 +65,7 @@ function readdir(path, ignores, callback) {
}
})
} else {
list.push(file)
list.push(filePath)
pending -= 1
if (!pending) {
return callback(null, list)
Expand Down

0 comments on commit 8604eae

Please sign in to comment.