diff --git a/index.js b/index.js index 6b722ab..5d952c6 100644 --- a/index.js +++ b/index.js @@ -8,10 +8,12 @@ const path = require('path'); * @param {string} modulefolder folder that contains all modules * @param {{opts: any, subdir: string, verbose: boolean}} options */ -module.exports = function (app, modulefolder, options) { - let { opts, subdir, verbose } = options; - if (typeof subdir === 'undefined') subdir = ''; - if (typeof verbose === 'undefined') verbose = false; +module.exports = function ( + app, + modulefolder, + options = { opts: undefined, subdir: '', verbose: false } +) { + const { opts, subdir, verbose } = options; for (const f of fs.readdirSync(modulefolder)) { const regex = /(.*?)-(.*?)\.js/;