internal trim function preferred over polyfill