Skip to content

Instantly share code, notes, and snippets.

@bingeboy
Created October 26, 2013 16:27
Show Gist options
  • Save bingeboy/7171478 to your computer and use it in GitHub Desktop.
Save bingeboy/7171478 to your computer and use it in GitHub Desktop.
Nodejs module Class pattern
// Constructor
function Foo(bar) {
// always initialize all instance properties
this.bar = bar;
this.baz = 'baz'; // default value
}
// class methods
Foo.prototype.fooBar = function() {
};
// export the class
module.exports = Foo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment