ventojs / vento

🌬 A template engine for Deno & Node
https://vento.js.org/
MIT License
212 stars 12 forks source link

Error using a variable as a key #55

Closed oscarotero closed 7 months ago

oscarotero commented 7 months ago

Hi @wrapperup

I've found another case to be handled by the transformer introduced in #43 : variables used as a key of other objects.

For example:

{{ message[key] }}

Should be transformed to

{{ it.message[it.key] }}

I've added a failing test: https://github.com/ventojs/vento/commit/dab98cd28f71b17b533c3b592c97d9d7cf76d978

Do you think it's possible to fix this? Thanks!

wrapperup commented 7 months ago

Looks like the MemberExpression node is also representation for array[x] syntax. I'll make a fix 👍.