From a578a0fe0cffd9fa0c02ac364b1cae56ea6ede87 Mon Sep 17 00:00:00 2001 From: Josh Duff Date: Thu, 4 Jan 2018 13:15:48 -0600 Subject: [PATCH] Update default extensions to match node Extension list sourced from https://nodejs.org/api/modules.html#modules_file_modules Fixes #137 --- lib/async.js | 2 +- lib/sync.js | 2 +- readme.markdown | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/async.js b/lib/async.js index dd889dc7..12bb6ed5 100644 --- a/lib/async.js +++ b/lib/async.js @@ -31,7 +31,7 @@ module.exports = function resolve(x, options, callback) { var isFile = opts.isFile || defaultIsFile; var readFile = opts.readFile || fs.readFile; - var extensions = opts.extensions || ['.js']; + var extensions = opts.extensions || ['.js', '.json', '.node']; var basedir = opts.basedir || path.dirname(caller()); opts.paths = opts.paths || []; diff --git a/lib/sync.js b/lib/sync.js index 2e0d5f24..a191c856 100644 --- a/lib/sync.js +++ b/lib/sync.js @@ -22,7 +22,7 @@ module.exports = function (x, options) { var isFile = opts.isFile || defaultIsFile; var readFileSync = opts.readFileSync || fs.readFileSync; - var extensions = opts.extensions || ['.js']; + var extensions = opts.extensions || ['.js', '.json', '.node']; var basedir = opts.basedir || path.dirname(caller()); opts.paths = opts.paths || []; diff --git a/readme.markdown b/readme.markdown index b59f2ab9..8c843988 100644 --- a/readme.markdown +++ b/readme.markdown @@ -82,7 +82,7 @@ default `opts` values: { paths: [], basedir: __dirname, - extensions: [ '.js' ], + extensions: [ '.js', '.json', '.node' ], readFile: fs.readFile, isFile: function isFile(file, cb) { fs.stat(file, function (err, stat) { @@ -136,7 +136,7 @@ default `opts` values: { paths: [], basedir: __dirname, - extensions: [ '.js' ], + extensions: [ '.js', '.json', '.node' ], readFileSync: fs.readFileSync, isFile: function isFile(file) { try {