-
Notifications
You must be signed in to change notification settings - Fork 120
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
added convert distance method to TurfHelper #481
Conversation
if (factor == null) { | ||
throw new TurfException("Invalid unit."); | ||
} else if (!(distance >= 0)) { | ||
throw new TurfException("distance must be a positive number"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the message to Distance must be a positive number.
for consistency.
Double factor = factors.get(originalUnit); | ||
if (factor == null) { | ||
throw new TurfException("Invalid unit."); | ||
} else if (!(distance >= 0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case doesn't seem to be tested (negative distance), only invalid units are.
thrown.expectMessage(startsWith("Invalid unit.")); | ||
TurfHelpers.convertDistance(1, "foo"); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: extra space.
Adds the convertDistance method https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/index.js#L396. It also adds support for centimeters and feet.
cc: @zugaldia