Comparing version 0.0.1 to 0.0.2
@@ -23,4 +23,2 @@ // | ||
var Dirscanner = function Dirscanner(target, ignore) { | ||
target = path.normalize(path.join(process.cwd(), target)); | ||
emitter.call(this); | ||
@@ -27,0 +25,0 @@ this._target = target; // Source path |
@@ -69,3 +69,4 @@ // | ||
if (err) { | ||
this.emit('error', err); | ||
// @TODO: Set error handler instead of keeping reference to ds? | ||
if (this._ds) this._ds.error(err); | ||
return; | ||
@@ -112,10 +113,13 @@ } | ||
// Ignore this file? | ||
var ignore = this._ds._ignore; | ||
for (var i = 0; i < ignore.length; i++) { | ||
var pattern = ignore[i]; | ||
var base = path.basename(target); | ||
if (base.match(pattern)) { | ||
this.emit('ignore', target); | ||
this.popPath(); | ||
return; | ||
// @TODO: Shift this property down to directory objects. | ||
if (this._ds) { | ||
var ignore = this._ds._ignore || []; | ||
for (var i = 0; i < ignore.length; i++) { | ||
var pattern = ignore[i]; | ||
var base = path.basename(target); | ||
if (base.match(pattern)) { | ||
this.emit('ignore', target); | ||
this.popPath(); | ||
return; | ||
} | ||
} | ||
@@ -122,0 +126,0 @@ } |
@@ -23,3 +23,3 @@ // | ||
File.prototype.readStream = function() { | ||
return fs.createReadStream(this._path); | ||
return fs.createReadStream(this.path); | ||
}; | ||
@@ -26,0 +26,0 @@ |
{ | ||
"name": "dirscanner", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Analyze a directory substructure and return it as an object.", | ||
@@ -5,0 +5,0 @@ "main": "dirscanner.js", |
9192
15
339