Skip to content

Instantly share code, notes, and snippets.

@subtleGradient
Created January 4, 2010 14:51
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 subtleGradient/268553 to your computer and use it in GitHub Desktop.
Save subtleGradient/268553 to your computer and use it in GitHub Desktop.
CommonJS: Module instances of global objects share prototypes?
String.prototype.foo = function(){ return "foo'd"; };
var myString1 = require('footools').myString;
var myString2 = "app";
myString1.foo(); // Fail?
myString2.foo(); // no Fail
exports.myString = "mod";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment