Effect JavaScript issues

So I have been working on a JavaScript “Effect” to recalculate results in the browser so I can implement this, and although it’s quite an exercise to reverse-engineer results out of the HTML the rescoring was pretty easy so I was thinking of giving it a trial at our club ‘in anger’, but…

  • It’s quite a big chunk of JavaScript so I am minifying it, but when including it as an effect it was truncated in the 1000th column. OK, I added a maximum line length to the minification settings: is this documented anywhere?

  • Something in Sailwave is parsing the JavaScript (–I wonder why?–*) and it doesn’t like ES6 template strings - it inserts !ERR! within the ` (backtick) delimiters. OK, I changed the transpilation to ES5 and now the code has almost doubled in size (8k) with polyfills. I can work around that.

  • … and now it works! But on reflection I’m thinking that changing the results in the browser is not a good idea, so that would mean some kind of post-processing on the server. Is there any other way I can do this?

Note: * I’ve just realised why you are sanitising JavaScript, makes sense.

Edit: code is on GitHub if anyone is interested.