airbnb / polyglot.js

Give your JavaScript the ability to speak many languages.
http://airbnb.github.io/polyglot.js
BSD 2-Clause "Simplified" License
3.71k stars 208 forks source link

Remove string.prototype.trim package #121

Closed lencioni closed 6 years ago

lencioni commented 6 years ago

This function has good browser support (ES5), and for older browsers it should be shimmed, so it seems relatively safe to use the prototype method directly instead of the string.prototype.trim package.

http://kangax.github.io/compat-table/es5/#test-String.prototype.trim

I believe this will reduce the bundle size impact of this package by 18.5 KiB.

ljharb commented 6 years ago

Since we're able to make this change with webpack's aliasing internally (it saved 6-7k), I don't think there's a need to do it here. Please reopen if you disagree.

lencioni commented 6 years ago

That's fine with me!

However, I just wanted to clarify the total savings amount. In my analysis, it would be closer to 19 KiB if we didn't have a different module (object.entries via react-with-styles-interface-aphrodite) importing es-abstract/es5.js. ;)