Skip to content

Instantly share code, notes, and snippets.

@subtleGradient
Forked from subtleGradient/commonjs_app.js
Created January 5, 2010 00:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subtleGradient/269015 to your computer and use it in GitHub Desktop.
Save subtleGradient/269015 to your computer and use it in GitHub Desktop.
"app".foo(); // Fail. The method `foo` doesn't exist
require('commonjs_mod'); // Modifies the String native
"app".foo(); // no Fail. The method `foo` was added
String.prototype.foo = function(){ return "foo'd"; };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment