Skip to content

Instantly share code, notes, and snippets.

@marcric
Created November 5, 2011 13:30
Show Gist options
  • Save marcric/1341497 to your computer and use it in GitHub Desktop.
Save marcric/1341497 to your computer and use it in GitHub Desktop.
cumulative export example
// node.js exercise
function privateSay(message) {
console.log("private: ", message);
};
function say(message) {
console.log("public: ", message);
};
function User(name) {
this.name = name;
};
var count = 0;
function create(name) {
count += 1;
return new User(name);
};
function count() {
return count;
};
// from now on I decide what to export
exports.say = say;
exports.User = User;
exports.create = create;
exports.count = count;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment