I haven't done extensive testing on this, so I may be wrong, but the way this package is currently set up isn't tree-shakeable by compilers that have that capability. This could be done by splitting files up and only importing what each export needs. The way I imagine this working is having an encode.js and a decode.js and having them import only the utility functions they need. The main file would simply be an export of those two (along with the other utility functions currently exported.)
This would also allow people who don't have tree shaking setup to import specific exports, like so:
I haven't done extensive testing on this, so I may be wrong, but the way this package is currently set up isn't tree-shakeable by compilers that have that capability. This could be done by splitting files up and only importing what each export needs. The way I imagine this working is having an
encode.js
and adecode.js
and having them import only the utility functions they need. The main file would simply be an export of those two (along with the other utility functions currently exported.)This would also allow people who don't have tree shaking setup to import specific exports, like so:
More info about Webpack's approach to tree shaking here: https://webpack.js.org/guides/tree-shaking/