title: Scope of dependencies when exporting a module in Node.js
body: <p>When exporting a module that has another dependency, is it best to include that dependency within the module export function or outside of it? I usually see the latter, but it seems like it would be best to keep it in the local scope. </p>
  
  <p>For example:</p>
  
  <pre><code>var foo = require('foo');
  
  module.exports = function(d) {
      return foo(d)/2;
  }
  </code></pre>
  
  <p>vs.</p>
  
  <pre><code>module.exports = function(d) {
      var foo = require('foo');
  
      return foo(d)/2;
  }
  </code></pre>