Essential Node.js patterns and snippets  In this post, I take a
look at the different patterns that you need to know when using
Node.js. These came from my own coding and from a look at the
code behind Tim Caswell’s flow control libraries. I think it is
necessary to know how these basic patterns are implemented even
if you use a library..  1. Objects and classes  1.1 Class
pattern  // Constructor var Class = function(value1, value2) {
this.value1 = value1; // properties and methods Class.prototype
= {   value1: "default_value",   method: function(argument) {
this.value2 = argument + 100; // node.js module export
module.exports = Class; // constructor call var object = new
Class("Hello", "2");  If the class is long, then instead of
doing a single Class.prototype = {…} assignment, it may be split
into multiple Class.prototype.method = function () {..}
assignments.  Reminder: Assign all your properties some value in
your constructor. Otherwise while the resulting object can
access the property defined in t