String.prototype.capitalize = function() { return this.replace(/(?:^|\s)\S/g, function(a) { return a.toUpperCase(); }); }; String.prototype.contains = function(subStr) { return this.indexOf(subStr) !== -1; }; String.prototype.containsWord = function(word) { var expStr = Mustache.render(" {{word}} |^{{word}} | {{word}}$|^{{word}}$", {word: word}); return this.match(new RegExp(expStr, "i")) != null; };