gabrielflorit / script-8.github.io

A JavaScript-based (React + Redux) fantasy computer for making, sharing, and playing tiny retro-looking games.
https://script-8.github.io/
MIT License
646 stars 35 forks source link

Changes code size to use the acorn token count instead of zipped character count #213

Closed Kethku closed 5 years ago

Kethku commented 5 years ago

When acorn can't parse a string, it throws an exception. So instead of doing anything fancy, I put the counter in a try catch which will return "ERROR" if parse fails.

I changed things around a bit while trying to figure out why things weren't working (I'm somewhat new to react) so if you dislike the style I can change it to be a bit more like it was.

I also removed the lz minified count because I figured it was superfluous now. If you would like the total character count with the token count where the minified one was instead I can do that as well, just let me know.

Kethku commented 5 years ago

Oh I also changed key to be the name of the asset instead of the index of the asset in the list. If you would like I can revert that as well.

gabrielflorit commented 5 years ago

This looks great, thank you for the quick PR.