People always get really enthusiastic about babel.
I get it. Using all of ES6 plus whatever stuff you want to throw at it is cool.
However, consider this:
:; npm i string-tokenize
This is roughly the same code. I ported it to not be written using ES6 Modules, used core node
assert instead of
chai (It has the same functionality being used!), and removed Flow type annotations. It works in node 8 easily, and should work in node 4.
I work in constrained environments: page load time is very important to me. If I’m loading even a fraction of this in a browser, I’ve blown my budget. I run a bunch of hobby projects on a very inexpensive server. RAM is at a premium. All of these things have costs.