benmarch / spel2js

Parse Spring Expression Language in JavaScript
Other
69 stars 19 forks source link

null expression not evaluating #10

Open vishalkumarnl opened 4 years ago

vishalkumarnl commented 4 years ago

suppose employe.id = null and expression = "employe.id ? true : false" if I am trying to evaluate the above expression using SpelExpressionEvaluator.compile(expression) function call. It returns NullPointer exception which was not happening in 0.2.5

benmarch commented 4 years ago

Hmm, let me take a look and get back to you. Can you provide a bit more code including the context and locals?

Raccoonwao commented 4 years ago

I have come to the same issue. Any possible workaround or solution is appreciated.

Here is another simple example throwing the exception

var spel2js = require("spel2js@0.2.7") // replace this 0.2.6 and it works var r = spel2js.SpelExpressionEvaluator.compile("X == 1") var row = { X : null, Y: 1.0 } r.eval(row)