fix regex for trim
create a separate object than 'this' for manipulation
refactor function invoker
throw type error if fn is not function