Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
CommonJS: Extending native prototypes from a module
require('footools').setup(Array, Boolean, Function, Number, RegExp, String);
"bar".foo(); // no Fail
require('footools').setup(Array, Boolean, Function, Number, RegExp, String);
"bar".foo(); // no Fail
// Framework codez
function FooTools(){
this.String.prototype.foo = function(){ return "foo'd"; };
};
// Exporting
if (typeof exports == 'undefined') var exports = {};
exports.setup = function(Array, Boolean, Function, Number, RegExp, String){
var context = {
Array : Array,
Boolean : Boolean,
Function : Function,
Number : Number,
RegExp : RegExp,
String : String
};
FooTools.apply(context);
};
<script src="mod.js"></script>
<script>FooTools.apply(window);</script>
<script>"bar".foo(); /*no Fail*/</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.