expr-eval icon indicating copy to clipboard operation
expr-eval copied to clipboard

Access object properties using brackets

Open guisehn opened this issue 8 years ago • 4 comments

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 "["

guisehn avatar Oct 04 '17 19:10 guisehn

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 avatar Oct 04 '17 21:10 silentmatt

@silentmatt - Glad you're on it! Just realized I couldn't access properties within an array :(

NordlingDev avatar Oct 12 '17 19:10 NordlingDev

I'm also hoping for this feature 👍

gustavjorlov avatar Apr 18 '18 19:04 gustavjorlov

This might expose some security issues detailed here

rfrm avatar Jun 03 '19 23:06 rfrm