Skip to content

Instantly share code, notes, and snippets.

@francisbrito
Created January 25, 2016 16:12
Show Gist options
  • Save francisbrito/ad28fad1f7b8da82f4b3 to your computer and use it in GitHub Desktop.
Save francisbrito/ad28fad1f7b8da82f4b3 to your computer and use it in GitHub Desktop.
// foo.js
module.exports = 'foo';
// index.js
var foo = require('./foo');
console.log(foo); // foo
// bar.js
exports.qux = 'qux';
exports.nix = 'nix';
exports.sabrina = 'is awesome';
// index.js
var bar = require('./bar'); // `bar` behaves like a namespace.
console.log(bar.qux);
console.log(bar.nix);
console.log(bar.sabrina);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment