Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access object properties using brackets #264

Open
coco-super opened this issue Dec 1, 2021 · 2 comments
Open

Access object properties using brackets #264

coco-super opened this issue Dec 1, 2021 · 2 comments

Comments

@coco-super
Copy link

coco-super commented Dec 1, 2021

Use the latest version and write the following code:
Parser.evaluate('in1["key"]', { in1: { key: 'value' } });

I expect the above code to output "value", but got undefined

Can you spare some time to have a look? Thank you. @silentmatt

@coco-super
Copy link
Author

I try to find answers in other issues. Find similar problems, but this is not what I want. #114

@coco-super
Copy link
Author

export function arrayIndex(array, index) {

The above code is modified as:

export function arrayIndex(array, index) {
  if (Array.isArray(array)) {
    return array[index | 0];
  }
  return array[index];
}

Then the world will be peaceful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant