Skip to content

Instantly share code, notes, and snippets.

@makenova
Created August 29, 2016 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makenova/7b2b563f788c0310a6a08c507ecf589d to your computer and use it in GitHub Desktop.
Save makenova/7b2b563f788c0310a6a08c507ecf589d to your computer and use it in GitHub Desktop.
Common JS objects
// 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"}
var singleton = require('./singleton');
singleton.color = 'red';
var singleton = {};
module.exports = singleton;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment