TomFrost / Jexl

Javascript Expression Language: Powerful context-based expression parser and evaluator
MIT License
559 stars 90 forks source link

Cannot read properties of undefined (reading '0') #129

Open DearGaz opened 1 year ago

DearGaz commented 1 year ago

const context = {"a": 1}; const exp = "a.b[0] != null"; jexl.eval(context, exp);//Cannot read properties of undefined (reading '0')

i'm building a dynamic rule engine and jexl contributes a lot. Appreciating for jexl very much! But there is a problem that has been bothering me for a long time. Just like the example code above: the rule engine expects that "a.b[0] != null" should be false, but jexl throws an exception like the comment. im wondering could jexl acts like lodash.get when he evals "a.b[0]" ? or any other suggestions?

Looking forward to your reply❤