Created
August 29, 2016 18:00
-
-
Save makenova/7b2b563f788c0310a6a08c507ecf589d to your computer and use it in GitHub Desktop.
Common JS objects
This file contains hidden or 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
// if other is not required for it's side effect, singleton will not have a color property. | |
var other = require('./other'); | |
var singleton = require('./singleton'); | |
console.log(JSON.stringify(singleton)); // => {"color":"red"} |
This file contains hidden or 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
var singleton = require('./singleton'); | |
singleton.color = 'red'; |
This file contains hidden or 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
var singleton = {}; | |
module.exports = singleton; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment