Skip to content

Commit fe71cde

Browse files
committed
Update convert-argv.js
Allow usage of ES6 default exported function for config
1 parent c5cc1d2 commit fe71cde

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

bin/convert-argv.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,13 @@ module.exports = function(optimist, argv, convertOptions) {
9494
configFileLoaded = true;
9595
}
9696

97-
if(typeof options === "function") {
97+
if(typeof options === "function" || (typeof options === "object" && typeof options["default"] === "object")) {
98+
options = options(argv.env, argv);
99+
}
100+
101+
var isES6DefaultExportedFunc = (typeof options === "object" && typeof options["default"] === "function");
102+
if(typeof options === "function" || isES6DefaultExportedFunc) {
103+
options = isES6DefaultExportedFunc ? options.default : options;
98104
options = options(argv.env, argv);
99105
}
100106

0 commit comments

Comments
 (0)