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

Add isIPRange validator #842

Merged
merged 3 commits into from
Jun 12, 2018
Merged

Add isIPRange validator #842

merged 3 commits into from
Jun 12, 2018

Conversation

excelciordan
Copy link
Contributor

Validate IP Ranges for IPv4.


export default function isIPRange(str) {
assertString(str);
const [ip, subnet, err] = str.split('/');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you mind avoiding this array destructuring syntax? It adds a fairly large helper function to validator.js and so validator.min.js

Example:

const parts = str.split('/', 3);
if (parts.length !== 2) {
    return false;
}
const ip = parts[0];
const subnet = parts[0];

@chriso
Copy link
Collaborator

chriso commented Jun 12, 2018

Thanks for the PR 😄

@chriso chriso merged commit 8e924a2 into validatorjs:master Jun 12, 2018
@excelciordan
Copy link
Contributor Author

excelciordan commented Jun 12, 2018 via email

@gabegorelick
Copy link

Any timeline on getting this released?

@chriso
Copy link
Collaborator

chriso commented Jun 19, 2018

@gabegorelick 10.4 is now available.

@gabegorelick
Copy link

@chriso Awesome! Thanks for the quick turnaround.

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.

3 participants