is it possible to export automatically all the functions defined in a module of node.js?
Example:
Let's say that in the file foobar.js I have the following two functions
function foo() {
...
}
function bar() {
...
}
Does exist a tool for adding them automatically to the exports dictionary so that the following code is made possible?
foobar = require('foobar.js')
foobar.foo(); // works, even if not explicitly added in 'exports'
foobar.bar(); // also works
In other words, I would like to add progressively new functions to the module and not having to add them manually to the export dictionary. So, the following is what I want to avoid:
exports.foo = foo;
exports.bar = bar;
Maybe this could be achieved by getting introspectively the list of all the functions defined in the module, but I also don't know how to achieve this.