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

#359 Method Refresh doesn't work with Value zero #360

Merged
merged 2 commits into from
Feb 15, 2021
Merged

#359 Method Refresh doesn't work with Value zero #360

merged 2 commits into from
Feb 15, 2021

Conversation

louagej
Copy link
Contributor

@louagej louagej commented Feb 15, 2021

Updated refresh
Added a check if min or max are numbers
When min and max are number, just take over value otherwise min max are set to null

dist/justgage.js Outdated
@@ -838,8 +838,20 @@
var obj = this;
var displayVal, color;

max = max || null;
min = min || null;
if (Number.isInteger(max) || Number(max) === max && max % 1 !== 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would create a custom function for this check and use something like

function isNumber(n) {
  return n !== null && n !== undefined && !isNaN(n)
}

and then use it like:

max = isNumber(max) ? max : null
min = isNumber(min) ? min : null

@louagej
Copy link
Contributor Author

louagej commented Feb 15, 2021

@robertsLando
I just added the requested function in a new commit: 4db6c0f
Regards,
Job

Copy link
Collaborator

@robertsLando robertsLando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@robertsLando robertsLando merged commit 869d3b4 into toorshia:master Feb 15, 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