2010-06-17 14:00:47 +00:00
|
|
|
if (!String.prototype.trim) {
|
|
|
|
|
String.prototype.trim = function () {
|
2010-09-14 22:57:55 +00:00
|
|
|
// this trim is not fully ES3 or ES5 compliant, but it should cover most cases for now
|
|
|
|
|
return this.replace(/^[\s\xA0]+/, '').replace(/[\s\xA0]+$/, '');
|
2010-06-17 14:00:47 +00:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function camelize(string) {
|
|
|
|
|
return string.replace(/-+(.)?/g, function(match, character) {
|
|
|
|
|
return character ? character.toUpperCase() : '';
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function capitalize(string) {
|
|
|
|
|
return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-10 01:50:13 +00:00
|
|
|
fabric.util.string = {
|
2010-06-17 14:00:47 +00:00
|
|
|
camelize: camelize,
|
|
|
|
|
capitalize: capitalize
|
|
|
|
|
};
|