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

Ensure that when we check typeof x == 'number' we also check instanceof Number #5752

Closed
wants to merge 3 commits into from

Conversation

etimberg
Copy link
Member

@etimberg etimberg commented Oct 1, 2018

This should resolve #3124 but I still need to write some tests

@benmccann
Copy link
Contributor

Maybe we should add a helpers.isFinite which does the following:

(typeof value === 'number' || value instanceof Number) && isFinite(value)

simonbrunel
simonbrunel previously approved these changes Oct 8, 2018
Copy link
Member

@simonbrunel simonbrunel left a comment

Choose a reason for hiding this comment

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

I agree with @benmccann, we could refactor this method in helpers.core.js with associated unit tests to prevent regressions.

@etimberg
Copy link
Member Author

I created the helper function and used it where possible. I had the helper function return false for non-numeric types. This means I couldn't use it in core.scale.

@benmccann
Copy link
Contributor

I approve this PR. GitHub is having trouble right now, so I can use the review functionality. Go ahead and merge when you're ready

@simonbrunel
Copy link
Member

This is merged, twice ... GitHub have some trouble indeed.

Closing manually to prevent a third merge.

benmccann pushed a commit to benmccann/Chart.js that referenced this pull request Oct 24, 2018
@etimberg etimberg deleted the number-instance branch October 27, 2019 20:46
exwm pushed a commit to exwm/Chart.js that referenced this pull request Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ Line Chart ] Line chart does not handle datapoints created with the Number constructor
3 participants