Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
22 lines (19 sloc) 508 Bytes
Math.clamp = function(a, min, max) {
return a < min ? min : (a > max ? max : a);
};
Array.prototype.indexContains = function(word) {
for (var idx = 0; idx < this.length; idx++) {
var test = this[idx];
if (test.indexOf(word) >= 0 || word.indexOf(test) >= 0) {
return idx;
}
}
return -1;
};
String.prototype.capitalize = function() {
if (this) {
return this.substr(0, 1).toUpperCase() + this.substr(1);
} else {
return '';
}
};