Created
January 25, 2016 16:12
-
-
Save francisbrito/ad28fad1f7b8da82f4b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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