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

fix(isMacAddress): improve regexes and options #1616

Merged
merged 6 commits into from
Feb 26, 2021

Conversation

fedeci
Copy link
Contributor

@fedeci fedeci commented Feb 24, 2021

Fixes #1614
This PR simplifies regexes, update the no_colons option name to noSeparators. Fixes macAddressWithDots regex to only allow dots as separator.

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)

@codecov
Copy link

codecov bot commented Feb 24, 2021

Codecov Report

Merging #1616 (06dd3a3) into master (9b03daf) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1616   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          100       100           
  Lines         1796      1794    -2     
=========================================
- Hits          1796      1794    -2     
Impacted Files Coverage Δ
src/lib/isMACAddress.js 100.00% <100.00%> (ø)

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 9b03daf...889284e. Read the comment docs.

Copy link
Member

@tux-tn tux-tn left a comment

Choose a reason for hiding this comment

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

Thank you @fedeci for your quick fix on this.
I can see that the issue here is related to the macAddressWithDots regex. The author forgot to escape the dot. I agree with your fix of the regex but I don't understand why you decided to change the behaviour (Hyphens and spaces are considered valid MAC Address separators) and the option name Introducing potential breaking changes (I know that no_colons is still supported in your code).

src/lib/isMACAddress.js Show resolved Hide resolved
src/lib/isMACAddress.js Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/lib/isMACAddress.js Outdated Show resolved Hide resolved
test/validators.js Outdated Show resolved Hide resolved
src/lib/isMACAddress.js Outdated Show resolved Hide resolved
@fedeci
Copy link
Contributor Author

fedeci commented Feb 24, 2021

I thought it was possible to join multiple suggested changes in one commit🤦

Copy link
Member

@tux-tn tux-tn left a comment

Choose a reason for hiding this comment

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

Thank your @fedeci for making the changes that fast 🎉 LGTM

@profnandaa profnandaa closed this Feb 26, 2021
@profnandaa profnandaa reopened this Feb 26, 2021
@profnandaa
Copy link
Member

Closing and re-opening to kick off Github actions.

@profnandaa profnandaa merged commit de48970 into validatorjs:master Feb 26, 2021
@fedeci fedeci deleted the improve-is-mac-address branch February 26, 2021 16:27
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.

isMACAddress support for macAddressWithDots might be incorrect
3 participants