Closed TylerMizuyabu closed 1 year ago
Hey Tyler! I'm afraid that's as-designed. If your top level keys have a hyphen in them, Jexl interprets the hyphen as a minus sign just like most programming languages. You hit on both the workarounds I'd recommend: Nesting those keys a layer deep so you can reference them in quotes, or converting them to camelcase.
Best of luck!
Trying to use jexl to evaluate boolean expressions where the keys used in the expression can have hyphens in them Example:
task-a && task-b
, however when I pass it a context object like this {"task-a": true, "task-b": true} the expression evaluates to null. Even the simple expression oftask-a
evaluates to null. It seems to be an issue with the hyphen in the key because the expressionstaskA && taskB
andtaskA
evaluates properly. Currently I'm doing a work around where I nest these values one level deeper in the context object like this { tasks: { "task-a" : true, "task-b": true } } and then I'm performing areplace()
call that changes the expression totasks["task-a"] && tasks["task-b"]
. But this seems like a bug. If it's intended or my use of the expression is just wrong please let me know