-
Notifications
You must be signed in to change notification settings - Fork 991
@turf/line-slice-along to TypeScript #2978
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
Conversation
| path.join(__dirname, "test", "fixtures", "route2.geojson") | ||
| ); | ||
|
|
||
| const options = { units: "miles" } as const; |
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.
I think this had been broken when we changed the options to an object
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.
Huh. So why wasn't the isObject call catching this? Or was bench just not being run by anyone?
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.
Yeah I think it was just broken. There's no actual testing making sure bench works. I don't think we really want to just burn CI time benchmarking though.
| path.join(__dirname, "test", "fixtures", "route2.geojson") | ||
| ); | ||
|
|
||
| const options = { units: "miles" } as const; |
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.
Huh. So why wasn't the isObject call catching this? Or was bench just not being run by anyone?
| ): Feature<LineString> { | ||
| // Optional parameters | ||
| options = options || {}; | ||
| if (!isObject(options)) throw new Error("options is invalid"); |
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.
Reckon we should set default units explicitly even if it effectively happens a lower level. Maybe we destructure similar to #2974?
const { units = "kilometers" } = options;
That'd also make sure we're not passing any rando options further down to distance or destination.
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.
Good point about accidentally sending extra options down.
|
|
||
| var coords; | ||
| var slice = []; | ||
| var coords: Position[]; |
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.
Another couple of vars we could jettison.
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.
Lets just apply eslint's no-var and prefer-const (in another PR)
No description provided.