TomFrost / Jexl

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

Array filter with number keys fails with (literal) unexpected #27

Open samgurtman-zz opened 7 years ago

samgurtman-zz commented 7 years ago

The expression "value[.9supPjNuM4LbbXHXC != 't'].firstName" fails with

Error: Token 9 (literal) unexpected in expression: value[.9

Therefore I cannot filter my array of objects which each have a key '9supPjNuM4LbbXHXC', ie:

{
  9supPjNuM4LbbXHXC: 'abc123',
  firstName: 'bob'
}
TomFrost commented 7 years ago

Oo, you are right on the mark with this one. Jexl doesn't allow variable names that start with a number because Javascript doesn't allow variable names that start with a number, but object properties are a different story entirely. This might be a little tricky... thanks for reporting it!