Otimização de string JavaScript

String.prototype.equals = function(value) {
return this.valueOf() === value.valueOf();
}

String.prototype.endsWith = function(value) {
return this.indexOf(suffix, this.length - value.length) !== -1;
}

String.prototype.startsWith = function(value) {
return this.indexOf(value) === 0;
}

String.prototype.isEmail = function() {
re
= /^((([a-z]|d|[!#$%&'*+-/=?^_`{|}~]|[u00A0-uD7FFuF900-uFDCFuFDF0-uFFEF])+(.([a-z]|d|[!#$%&'*+-/=?^_`{|}~]|[u00A0-uD7FFuF900-uFDCFuFDF0-uFFEF])+)*)|((x22)((((x20|x09)*(x0dx0a))?(x20|x09)+)?(([x01-x08x0bx0cx0e-x1fx7f]|x21|[x23-x5b]|[x5d-x7e]|[u00A0-uD7FFuF900-uFDCFuFDF0-uFFEF])|(\([x01-x09x0bx0cx0d-x7f]|[u00A0-uD7FFuF900-uFDCFuFDF0-uFFEF]))))*(((x20|x09)*(x0dx0a))?(x20|x09)+)?(x22)))@((([a-z]|d|[u00A0-uD7FFuF900-uFDCFuFDF0-uFFEF])|(([a-z]|d|[u00A0-uD7FFuF900-uFDCFuFDF0-uFFEF])([a-z]|d|-|.|_|~|[u00A0-uD7FFuF900-uFDCFuFDF0-uFFEF])*([a-z]|d|[u00A0-uD7FFuF900-uFDCFuFDF0-uFFEF]))).)+(([a-z]|[u00A0-uD7FFuF900-uFDCFuFDF0-uFFEF])|(([a-z]|[u00A0-uD7FFuF900-uFDCFuFDF0-uFFEF])([a-z]|d|-|.|_|~|[u00A0-uD7FFuF900-uFDCFuFDF0-uFFEF])*([a-z]|[u00A0-uD7FFuF900-uFDCFuFDF0-uFFEF]))).?$/;
return re.test(this);
}

String.prototype.ucfirst = function(value) {
return this.charAt(0).toUpperCase() + this.slice(1)
}

String.prototype.crop = function(size, pattern) {
if (pattern === undefined)
pattern
= ' ... ';

if (this.length <= size)
return this;

s
= Math.floor((size - pattern.length) / 2);
return this.substr(0, s) + pattern + this.substr(this.length - s, s)
}

//Thx to @vrunoa
String.prototype.trim = function() {
return this.replace(/^s+/g,'').replace(/s+$/g,'');
}

Uso:

'foo'.equals('bar') // FALSE
'lorem ipsum'.endsWith('ipsum') // TRUE
'lorem ipsum'.startsWith('ipsum') // FALSE
'example@email.com'.isEmail() // TRUE
'пример@мыло.рф'.isEmail() // TRUE
'example.com'.isEmail() // FALSE
'example@email'.isEmail() // FALSE
'foo'.ucfirst() // Foo
'Lorem ipsum dolor sit amet, consectetur adipisicing elit'.crop(25) // Lorem ipsu ... sicing elit