TomFrost / Jexl

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

fix: empty array does not throw error when traversing #100

Open lianqin7 opened 3 years ago

lianqin7 commented 3 years ago

When travers a property in empty array, TypeError would be thrown

const context = {
  foo: {
    bar: []
  }
}

// before
// 'foo.bar.tek.hello' --> [TypeError: Cannot read property 'tek' of undefined]

// after
// 'foo.bar.tek.hello' --> undefined