module.exports that include all functions in a single line

You can write all your function declarations first and then export them in an object:

function bar() {
   //bar
}

function foo() {
   //foo
}

module.exports = {
    foo, bar
};

There’s no magical one-liner though, you need to explicitly export the functions you want to be public.

Leave a Comment