I have written the following code snippet to enhance all the objects in JavaScript and would like to make this method available to all the JavaScript libraries that I write. How should I go about doing this in node.js?
Object.prototype.copy = function() {
var that = this,
obj = {};
for (var key in that) {
if (that.hasOwnProperty(key)) {
obj[key] = that[key];
}
}
return obj;
}