title: How to export an object with Browserify?
body: <p>I started using Browserify and not sure if I completely understand how to use it.</p>
  
  <p>I have a file with some functions bundled in one object in <code>foo.js</code></p>
  
  <pre><code>var foo = {
    f1: function(){...}
    f2: function(){...}
  }
  
  module.exports = function () {
    return foo;
  };
  </code></pre>
  
  <p>And I want to export them to a variable in the <code>main.js</code> file, so I tried doing this:</p>
  
  <pre><code>var bar = require('/foo')();
  </code></pre>
  
  <p>The goal is to be able to do <code>bar.f1()</code>.
  Without executing <code>require('/foo')</code> I get only a function definition, so I have to execute it. Am I doing something wrong?</p>