Forked from HenrikJoreteg/JS Util solution using underscore.js
Created
October 30, 2010 03:37
-
-
Save savage69kr/654900 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If you don't use underscore.js, use it (http://documentcloud.github.com/underscore/) | |
// Then, use underscore's own extend method to extend it with all your other utility methods | |
// like so: | |
_.extend(_, { | |
escapeHtml: function () { | |
return this.replace(/&/g,'&') | |
.replace(/>/g,'>') | |
.replace(/</g,'<') | |
.replace(/"/g,'"') | |
.replace(/'/g,'''); | |
}, | |
otherFunc: function () { | |
// etc, etc. | |
} | |
}); | |
// simple. but. handy. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment