Skip to content

Fix function check in var method #36

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

Merged
merged 2 commits into from
Oct 8, 2024

Conversation

horacio-penya
Copy link
Contributor

Rules like:

logic.run({var: 'toString'},{toString: 'hello'}) // expect "hello"
logic.run({var: 'values'},{values: [1,2,3]}) // expect [1,2,3]

return null because "hello".toString is a function, even if we want to get "hello" (a valid object, not a function)

This happens because we're checking for context[key] even when key is already implied in context because we have descended into it during the previous for loop.

@TotalTechGeek
Copy link
Member

Hey, I think I'll merge this, but I might make some touch ups afterwards. I did some additional testing on my side and it appears good.

@TotalTechGeek TotalTechGeek merged commit 219b0d0 into json-logic:master Oct 8, 2024
3 of 4 checks passed
@TotalTechGeek
Copy link
Member

Thanks for the PR @horacio-penya.

I've provided a few other minor tweaks and have pushed a new version of this package out as 1.3.7

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

Successfully merging this pull request may close these issues.

2 participants