Skip to content

Commit

Permalink
fix: handling of array index
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Jul 8, 2024
1 parent a0fa351 commit 3a7cae6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,9 @@ async function renderValue(node, data, placeholder, renderAs, renderedNode, inde
let value;
try {

if (match[1] === 'index' && index >= 0) { // {[]} - Dot-notation
if (match[1] === 'index' && index >= 0) { // {{index}} - index
value = index
match[0] = '{{' + match[1] + '}}'
} else if (match[1].startsWith('[') && match[1].endsWith(']')) { // {[]} - Dot-notation
match[1] = match[1].slice(1, -1);
value = getRenderValue(node, data, match[1], renderAs);
Expand Down

0 comments on commit 3a7cae6

Please sign in to comment.