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

Users/elendil326/compare versions as integers #55

Merged
merged 5 commits into from Jun 20, 2018

Conversation

elendil326
Copy link
Contributor

Adding version comparison as numbers rather than strings.

@elendil326 elendil326 requested a review from zurdev June 14, 2018 18:16
}

// Min set of common segments is equal, check for extra segments greater than zero
var longerVersion = minLengthToCompare == xParts.length ? yParts : xParts;
Copy link
Contributor

Choose a reason for hiding this comment

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

consider simplifying by pushing 0's to the lesser array, xParts or yParts, to make them equal in length

if (diff) {
return diff;
}
var shorterVersion = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

How about:
while (xParts.length < yParts.length) xParts.push('0');
while (yParts.length < xParts.length) yParts.push('0');
// Compare parts
...

Copy link
Contributor

@zurdev zurdev left a comment

Choose a reason for hiding this comment

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

Looks good.

@elendil326 elendil326 merged commit 23ce1b0 into master Jun 20, 2018
@elendil326 elendil326 deleted the users/elendil326/compare_versions_as_integers branch June 20, 2018 23:09
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.

None yet

2 participants