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

fixed isVarUndefined when the value of variable is boolean false #56

Merged

Conversation

vaidkaran
Copy link
Contributor

@vaidkaran vaidkaran commented Apr 7, 2021

Description of the Change

When a variable of like processBills:

const variables = { processBills: { type: 'Boolean', value: false } }

with type Boolean and value false is sent to gotql, gotql interprets the value of the variable as undefined.
This is because of the way the value of the variable is checked for existence.
Currently, it's checked with !variables[varName].value
And in case the variables[varName].value is a boolean false, the expression !variables[varName].value resolves to a boolean true, which is then returned by the function isVarUndefined.

To fix this, we should check for the value being undefined simply by doing variables[varName].value === undefined

Alternate Designs

Why Should This Be here?

It fixes a bug when a variable with a boolean false value is sent to gotql

Benefits

Users will be able to use variables with a boolean false value

Possible Drawbacks

Applicable Issues

@khaosdoctor
Copy link
Owner

Hi! Thanks a lot for your help! This completely passed by me, I'll merge the PR and add a test to ensure this won't occur anymore.

@khaosdoctor khaosdoctor merged commit 03c1330 into khaosdoctor:main Apr 13, 2021
khaosdoctor added a commit that referenced this pull request Apr 13, 2021
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