fix to $.trim

This is just a protection for trimming undefined value 
```javascript
var foo = {}
$.trim(foo.bar)  --> throw an error.
```