Comparing version 0.1.0 to 0.2.0
17
index.js
@@ -28,2 +28,3 @@ 'use strict'; | ||
* @param {Function} [options.mask] | ||
* @param {Boolean} [options.ignoreError=true] | ||
*/ | ||
@@ -37,2 +38,5 @@ Diread.prototype.initialize = function(options) { | ||
function() { return true; }; | ||
this._ignore_error = options.ignoreError === void 0? | ||
true : | ||
options.ignoreError; | ||
@@ -42,5 +46,8 @@ this._current_read_level = 0; | ||
try { | ||
if(this._ignore_error) { | ||
try { | ||
this._read_by_path(this._directory_path, ''); | ||
} catch(err) {} | ||
} else { | ||
this._read_by_path(this._directory_path, ''); | ||
} catch(err) { | ||
} | ||
@@ -88,3 +95,3 @@ }; | ||
if(is_directory) { | ||
if(this._check_directories) { | ||
if(this._check_directories && path !== this._directory_path) { | ||
if(!this._mask(path)) { | ||
@@ -94,5 +101,3 @@ return; | ||
if(path !== this._directory_path) { | ||
this._list_of_file_path.push(path); | ||
} | ||
this._list_of_file_path.push(path); | ||
} | ||
@@ -99,0 +104,0 @@ |
{ | ||
"name": "diread", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Module for reading all files in directory", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -63,2 +63,16 @@ 'use strict'; | ||
}); | ||
it('should not check self directory', function() { | ||
var initial_folder = Path.resolve(process.cwd(), 'test/folder'); | ||
Diread({ | ||
src: initial_folder, | ||
directories: true, | ||
ignoreError: false, | ||
mask: function(path) { | ||
assert.notEqual(initial_folder, path); | ||
return true; | ||
} | ||
}); | ||
}); | ||
}); |
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
6944
182