expr-eval
expr-eval copied to clipboard
Access object properties using brackets
Is there a way to access object properties using brackets? Currently, it seems there's no way to access an object property that has spaces on its name. e.g.
let expr = Parser.parse('a["property with spaces"]');
console.log(expr.evaluate({ a: { 'property with spaces': 5 } }));
throws
Error: parse error [1:2]: Unknown character "["
Right now there's no way to do that. I'm planning on adding support for arrays in the near future, and that would add support for this for free, so it's most likely coming soon.
@silentmatt - Glad you're on it! Just realized I couldn't access properties within an array :(
I'm also hoping for this feature 👍
This might expose some security issues detailed here