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

strict mode for parsing numbers via regular expressions #7

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

russaa
Copy link

@russaa russaa commented Sep 6, 2018

alternative approach to pr #6 that validates numbers directly using regular expressions (following the number-token grammar rule in CSS spec)

image

@russaa russaa changed the title Feature/strict mode via regular expression strict mode for parsing numbers via regular expression Sep 6, 2018
@russaa russaa changed the title strict mode for parsing numbers via regular expression strict mode for parsing numbers via regular expressions Sep 6, 2018
@codecov
Copy link

codecov bot commented Sep 6, 2018

Codecov Report

Merging #7 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master     #7   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines          57     76   +19     
  Branches       11     18    +7     
=====================================
+ Hits           57     76   +19
Impacted Files Coverage Δ
src/index.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 77735aa...7d0bd70. Read the comment docs.

@jednano
Copy link
Owner

jednano commented Sep 6, 2018

I love that you referenced the CSS spec for the number token. You might hate me for saying this, but I think the complexity of parsing the number by itself might warrant an npm package of its own. Something that does nothing else but parse a number. This project parses a dimension, which could be a percent or something else, but the CSS spec you just referenced is for purely a number.

@russaa
Copy link
Author

russaa commented Sep 6, 2018

well, if you would be willing to take the repo over, I could prepare one based on this one -- i.e. strip everything except for number-validation & rename etc

@jednano
Copy link
Owner

jednano commented Sep 6, 2018

I think I'm going to start a new project for just the number parsing. My schedule is pretty booked over the coming week though, so it might take a bit.

@russaa
Copy link
Author

russaa commented Sep 6, 2018

no worries -- at least I am not in a hurry

when you find the time, let me know when/if I can contribute something

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