Skip to content

Add IP Address Validation and Separate IP and URI Logic to Files #619

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

Closed
wants to merge 1 commit into from
Closed

Add IP Address Validation and Separate IP and URI Logic to Files #619

wants to merge 1 commit into from

Conversation

DavidTPate
Copy link
Contributor

This PR adds the ability to do IP address validation and updates the handling of the components used to build Regular Expressions for both IP and URI validation into files. Additionally, this replaces the old usage of Array.reduce() which was occurring before in both IP and URI validation construction in favor of the standard for(...) loop.

This resolves #607 and #617

@DavidTPate
Copy link
Contributor Author

@Marsup I got them split out where I thought they should be. I left the validation of options within String still since that is where I think it belongs, I can move it if desired to the appropriate file.

@@ -116,6 +116,9 @@ exports.errors = {
uppercase: 'must only contain uppercase characters',
trim: 'must not have leading or trailing whitespace',
creditCard: 'must be a credit card',
ref: 'references "{{ref}}" which is not a number'
ref: 'references "{{ref}}" which is not a number',
ip: 'must be a valid ip address',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Regroup those under one option.

@Marsup Marsup added the feature New functionality or improvement label Mar 27, 2015
@Marsup Marsup added this to the 6.1.0 milestone Mar 27, 2015
@Marsup Marsup self-assigned this Mar 27, 2015
ipOptions.version = [ipOptions.version];
}

var version;
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't need that outside the loop.

@Marsup
Copy link
Collaborator

Marsup commented Mar 27, 2015

You're missing many line breaks in the tests as well but I won't comment on all of them.

@DavidTPate
Copy link
Contributor Author

Gotcha. I'll go through on the pieces you commented on, as well as the rest of the code. I've been getting more familiar with the coding style from the contrib repo.

@DavidTPate
Copy link
Contributor Author

@Marsup I think it's all set now. I went through and tried to find all the syntax issues I could and addressed your feedback. I also figured out what I did wrong when trying to squash things before (I wasn't force pushing before), so I squashed the changes together.


var regex = internals.ipRegex;
ipOptions = ipOptions || {};
Hoek.assert(typeof ipOptions === 'object', 'ipOptions must be an object');
Copy link
Collaborator

Choose a reason for hiding this comment

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

simply options

});

describe('#ip({ version: "ipvfuture" })', function() {
it('should validate all ipvfuture addresses with a default CIDR strategy', function(done) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Line break

@Marsup
Copy link
Collaborator

Marsup commented Mar 30, 2015

Do you know how to rebase your commits or should I do it ?

@DavidTPate
Copy link
Contributor Author

@Marsup It should be all squashed and include the changes for your comments about the error messages.

@Marsup
Copy link
Collaborator

Marsup commented Mar 30, 2015

Your patch contains things that have nothing to do with this, you must have failed the rebase.

@DavidTPate
Copy link
Contributor Author

Darn! Must have been that merge previously to catch up to the 6.1.0 branch. I'll take a look.

@Marsup
Copy link
Collaborator

Marsup commented Apr 2, 2015

@DavidTPate where are we on this ?

…ure with or without a CIDR.

Separate out IP and URI as well as their shared parts into their own files to keep `string` simpler and easier to understand.
@DavidTPate
Copy link
Contributor Author

@Marsup The changes only include those for the PR now. That was really odd, I had changed permissions and items that I didn't expect included in my commits from when I merged somehow. Never had that happen before.

@Marsup
Copy link
Collaborator

Marsup commented Apr 2, 2015

Rebased on branch, thanks.

@Marsup Marsup closed this Apr 2, 2015
@DavidTPate DavidTPate deleted the separate-ip-and-uri branch April 3, 2015 14:22
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New functionality or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants