title: Should node.js modules export named functions or an object?
body: <p>Which is the better pattern to use when creating modules in Node.js that have multiple functions that are called "statically" i.e. not using the <code>new</code> keyword. Is there an equivalent in ES6 I am missing?</p>
  
  <p><strong>Pattern 1.</strong></p>
  
  <pre><code>// math.js
  module.exports.add = (x, y) =&gt; {
      return x + y;
  }
  
  module.exports.multiply = (x, y) =&gt; {
      return x * y;
  };
  
  // app.js
  const math = require('./math.js');
  console.log(math.add(2, 3));
  </code></pre>
  
  <p><strong>Pattern 2.</strong></p>
  
  <pre><code>// math.js
  module.exports = {
      add: (x, y) =&gt; {
          return x + y;
      },
      multiply: (x, y) =&gt; {
          return x * y;
      }
  };
  
  // app.js
  const math = require('./math.js');
  console.log(math.add(2, 3));
  </code></pre>