SERVER-8201: clean up String trim functions for ES5