Comparing version 0.0.5 to 0.1.0
25
index.js
@@ -26,8 +26,3 @@ var fs = require('fs'); | ||
if (cb) cb(file, stat); | ||
em.emit('path', file, stat); | ||
if (stat.isSymbolicLink()) { | ||
em.emit('link', file, stat); | ||
} | ||
if (inodes[stat.ino]) { | ||
@@ -37,12 +32,16 @@ // already seen this inode, probably a recursive symlink | ||
} | ||
else if (stat.isDirectory()) { | ||
em.emit('directory', file, stat); | ||
finder(file, this); | ||
} | ||
else { | ||
em.emit('file', file, stat); | ||
this(null); | ||
em.emit('path', file, stat); | ||
if (stat.isDirectory()) { | ||
em.emit('directory', file, stat); | ||
finder(file, this); | ||
} | ||
else { | ||
em.emit('file', file, stat); | ||
this(null); | ||
} | ||
inodes[stat.ino] = true; | ||
} | ||
inodes[stat.ino] = true; | ||
}) | ||
@@ -49,0 +48,0 @@ .seq(f.bind({}, null)) |
{ | ||
"name" : "findit", | ||
"version" : "0.0.5", | ||
"version" : "0.1.0", | ||
"description" : "Walk a directory tree.", | ||
@@ -5,0 +5,0 @@ "main" : "./index.js", |
var assert = require('assert'); | ||
var findit = require('findit'); | ||
var findit = require('../'); | ||
var Hash = require('hashish'); | ||
@@ -7,14 +7,14 @@ | ||
var find = findit.find(__dirname + '/cycle'); | ||
var found = { directory : [], link : [], file : [] }; | ||
var found = { directory : [], file : [], path : [] }; | ||
find.on('directory', function (dir, stat) { | ||
find.on('directory', function (dir) { | ||
found.directory.push(dir); | ||
}); | ||
find.on('link', function () { | ||
found.link.push(dir); | ||
find.on('file', function (file) { | ||
found.file.push(file); | ||
}); | ||
find.on('file', function (file) { | ||
found.file.push(dir); | ||
find.on('path', function (file) { | ||
found.path.push(file); | ||
}); | ||
@@ -30,4 +30,4 @@ | ||
directory : [ 'meep', 'meep/moop' ], | ||
link : [ 'meep/moop' ], | ||
file : [] | ||
file : [], | ||
path : [ 'meep', 'meep/moop' ] | ||
}, function (x) { | ||
@@ -40,3 +40,5 @@ return x.map(function (dir) { | ||
assert.deepEqual(dirs.directory, found.directory); | ||
assert.deepEqual(dirs.file, found.file); | ||
assert.deepEqual(dirs.path, found.path); | ||
}); | ||
}; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8979
211
90