Skip to content

Instantly share code, notes, and snippets.

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 savage69kr/654900 to your computer and use it in GitHub Desktop.
Save savage69kr/654900 to your computer and use it in GitHub Desktop.
// 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,'&lt;')
.replace(/"/g,'&quot;')
.replace(/'/g,'&#39;');
},
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