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 bug when the number of segments is integer(line-chunk) #1046

Merged
merged 5 commits into from
Oct 27, 2017

Conversation

xiongjiabin
Copy link
Contributor

if numberOfSegments is an integer, like line length is 100, and segmentLength is 10, it's just 10 segments, no need to plus 1 to 11, otherwise will throw an exception later.

if numberOfSegments is an integer,  like line length is 100, and segmentLength is 10, it's just 10 segments,
no need to plus 1 to 11, otherwise will throw exception later.
fix bug when the number of segments is integer(line-chunk)
@DenisCarriere
Copy link
Member

@xiongjiabin Why did you close this PR? this looked fine...? just needed a few linting fixes

@DenisCarriere DenisCarriere reopened this Oct 27, 2017
@DenisCarriere
Copy link
Member

@xiongjiabin You should need to fix the linting issues:

This should be the code:

    var numberOfSegments = lineLength / segmentLength;

    // If numberOfSegments is integer, no need to plus 1
    if (!Number.isInteger(numberOfSegments)) {
        numberOfSegments = Math.floor(numberOfSegments) + 1;
    }

@DenisCarriere DenisCarriere added this to the 5.0.0 milestone Oct 27, 2017
Copy link
Member

@DenisCarriere DenisCarriere left a comment

Choose a reason for hiding this comment

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

👍

@DenisCarriere DenisCarriere merged commit cb92232 into Turfjs:master Oct 27, 2017
@xiongjiabin
Copy link
Contributor Author

I found failed in lint, so close the PR, thanks!

@DenisCarriere
Copy link
Member

This is why we have automated testing, to catch minor issues like Linting, no need to close PR, just commit a new fix with the provided error from TravisCI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants