From ee4870caeb012bf3cb26f4e9d92d057707e474cf Mon Sep 17 00:00:00 2001 From: Jaap Chen Date: Wed, 6 Jul 2022 00:09:52 +0800 Subject: [PATCH] fix #114 Object properties access by variable --- src/functions.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/functions.js b/src/functions.js index c3c5d20..f33802b 100644 --- a/src/functions.js +++ b/src/functions.js @@ -250,8 +250,11 @@ export function setVar(name, value, variables) { return value; } -export function arrayIndex(array, index) { - return array[index | 0]; +function arrayIndex(array, index) { + if (Array.isArray(array)) { + return array[index | 0]; + } + return array[index]; } export function max(array) {