TomFrost / Jexl

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

Collection filtering on identifiers gives empty result #38

Closed copitz closed 5 years ago

copitz commented 6 years ago

Hi,

thank you for this awesome library :)

I just noticed that:

const context = {
  items: [
    {id: 123, title: 'Hello world'},
    {id: 456, title: 'Good bye world'}
  ],
  my: {
    itemId: 123
  }
}

// The following will resolve with an empty array:
jexl.eval('items[.id == my.itemId]', context).then(console.log)

// While this will give the correct subset:
jexl.eval('items[.id == (my.itemId)]', context).then(console.log)
TomFrost commented 6 years ago

Oh my! That's an alarming bug indeed... thanks for reporting! I'll look into this.

TomFrost commented 5 years ago

Apologies for the SUPER late fix -- but this is now corrected in version 2.0.1!