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

new feature: support hex number like 0xfff #1306 #2798

Closed
wants to merge 3 commits into from

Conversation

duzc2
Copy link
Contributor

@duzc2 duzc2 commented Aug 10, 2019

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide

The details

Resolves

#1306

Reason for Changes

#1306

Test Coverage

Tested on:

  • Desktop Chrome

@duzc2
Copy link
Contributor Author

duzc2 commented Aug 10, 2019

#1306

@duzc2 duzc2 closed this Aug 10, 2019
@RoboErikG RoboErikG reopened this Aug 12, 2019

// Clean up number.
var n = Number(newValue || 0);
var hex = newValue.match(/^0xX+$/g);
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't do what you think it does. This match is looking for start of the line followed by '0x' followed by 1 or more 'X' characters followed by the end of the line. So it would match '0xXXXXXXXXXXXX' but not '0xabc'.

// Clean up number.
var n = Number(newValue || 0);
var hex = newValue.match(/^0xX+$/g);
var n = hex ? parseInt(newValue, 16) : Number(newValue || 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

This also isn't necessary, Number('0xabc') and parseInt('0xabc', 16) both return the same value, 2748. Converting a 3 letter hex color to a 6 letter number is a bit trickier than this.

@RoboErikG
Copy link
Contributor

This was already fixed by #2758

@RoboErikG RoboErikG closed this Aug 13, 2019
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