6utt3rfly / jse-eval

Javascript Expression Evaluator
MIT License
22 stars 7 forks source link

New operator is not wholly supported #70

Closed rossm6 closed 1 year ago

rossm6 commented 1 year ago

I've noticed something like this doesn't work.

const { evaluate, parse, registerPlugin }= require('jse-eval');
const newPlugin = require('@jsep-plugin/new');
registerPlugin(newPlugin);
const p = parse("new Date(new Date().setDate(new Date().getDate()-5))");
evaluate(p, { Date }); // gives error: Error: 'setDate' is not a function
6utt3rfly commented 1 year ago

Thanks for reporting @rossm6 ! It looks like an incorrect AST is being generated by JSEP (and I see the related issue you submitted there).

6utt3rfly commented 1 year ago

closed in jsep-plugin/new v1.0.3