This can best be seen from some of the files from other packages that were pulled into the code base, rather than referenced as dependencies in package.json
.
This opening comment from simple-toolpath.js
for example
// This file was translated from
// https://github.com/cncjs/gcode-toolpath/blob/master/src/Toolpath.js
// by Babel (http://babeljs.io/repl), with preset "stage-2"
// The import and export statements were first removed from Toolpath.js
And this from simple-parser.js
// This file was derived from
// https://github.com/cncjs/gcode-parser/blob/master/src/index.js
// by extracting just the parseLine() function and using Babel to
// translate that to older Javascript
At that time the best decisions would have been to go straight to TypeScript, because the TypeScript transpiler (even back then) would have allowed you to target any version of Javascript you wanted. And it would do all of this work reliably.
But perhaps the opening comment from simple-interpreter.js
really spells it out
/* eslint no-continue: 0 */
// This file was derived from
// https://github.com/cncjs/gcode-interpreter/blob/master/src/Interpreter.js
// as follows:
// a) Removed the import and export sections, and manually translated from
// class syntax to prototype syntax, for compatibility with old browsers
// b) Removed all of the load* methods, replacing them with a single method
// loadFromLinesSync(). Since we know that the interpreter will be called
// twice, first to determine the bounding box (for sizing the canvas) and
// then to render onto the canvas, the gcode string can be broken into an
// array of lines once and that array reused for both passes. This also
// eliminates the need for a parseStringSync() function in simple-parser;
// the only necessary function is parseLine().
// c) Replaced const with var
// d) Replaced arrow functions with real functions
// e) Replaced let with var
Everything, apart from perhaps item ‘b’, was a bad decision.
How to support older browsers is an important question. And when that browser is too old, the correct decision is genuinely; “don’t support it”.
So what is too old? Does the browser have significant security issues? Can it meet what’s considered baseline as at about 2 years before now? Does it have its own way of doing things that no other browser does? Answer yes to any one of those questions, then it’s too old, and you need to specifically call it out for people. They need to be helped to upgrade, rather than everyone else be held back.