Remove the spaces before and after the string
1. Example
2. Method
trim: function (obj) {
if (typeof obj === 'string') {
return obj.replace(/^\s+|\s+$/gm, '');
} else {
return obj
}
}