add String.prototype.trim

This commit is contained in:
rolux 2012-05-25 14:16:51 +02:00
parent e47f826329
commit e480d87b34

View file

@ -118,3 +118,10 @@ if (!Object.keys) {
return ret; return ret;
}; };
} }
// see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/Trim
if (!String.prototype.trim) {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
};
}