Solutionunvalidated
new Function(userCode); — verify (client-side) that the user has entered valid JavaScript code. Tension: Pulling in a Javascript parser (e.g. Acorn or Esprima) is a relatively heavy dependency. Outcome: Parsing/compiling JS code is safe and has no side effects.
923f4771-6589-4349-91ea-93de5f540a1a
new Function(userCode); — verify (client-side) that the user has entered valid JavaScript code. Tension: Pulling in a Javascript parser (e.g. Acorn or Esprima) is a relatively heavy dependency. Outcome: Parsing/compiling JS code is safe and has no side effects.