module.exports that include all functions in a single line

I have done something like the following:

var Exported = {
   someFunction: function() { },
   anotherFunction: function() { },

module.exports = Exported;

I require it in another file and I can access those functions

var Export = require('path/to/Exported');

This is essentially just an object with functions in it, and then you export the object.

A really old question but I just had to solve the same issue myself. the solution I used was to define a Class inside the module to contain all my functions and simply export an instance of the class.

classes.js looks like this:

class TestClass
   Function1() {
        return "Function1";
    Function2() {
        return "Function2";

module.exports = new TestClass();

app.js looks like this:

const TestClass = require("./classes");
console.log( TestClass.Function1);

just keep adding more functions to the class and they will be exported :)

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

function bar() {

function foo() {

module.exports = {
    foo, bar

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