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.
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.