diff --git a/lib/index.js b/lib/index.js index ac9f925..65a05ec 100644 --- a/lib/index.js +++ b/lib/index.js @@ -359,6 +359,10 @@ utile.requireDir = function (directory) { files = fs.readdirSync(directory); files.forEach(function (file) { + if (file[0] === '.') { + return; + } + if (file.substr(-3) === '.js') { file = file.substr(0, file.length - 3); } @@ -379,6 +383,10 @@ utile.requireDirLazy = function (directory) { files = fs.readdirSync(directory); files.forEach(function (file) { + if (file[0] === '.') { + return; + } + if (file.substr(-3) === '.js') { file = file.substr(0, file.length - 3); } diff --git a/test/fixtures/require-directory/.dot_directory/.gitignore b/test/fixtures/require-directory/.dot_directory/.gitignore new file mode 100644 index 0000000..5e7d273 --- /dev/null +++ b/test/fixtures/require-directory/.dot_directory/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/test/fixtures/require-directory/.dot_file.js b/test/fixtures/require-directory/.dot_file.js new file mode 100644 index 0000000..c6fb42d --- /dev/null +++ b/test/fixtures/require-directory/.dot_file.js @@ -0,0 +1,2 @@ +exports.me = 'dot_file.js'; +