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

Intersect documentation is outdated #951

Closed
ricardo-kagawa opened this issue Sep 18, 2017 · 4 comments
Closed

Intersect documentation is outdated #951

ricardo-kagawa opened this issue Sep 18, 2017 · 4 comments
Labels
Milestone

Comments

@ricardo-kagawa
Copy link

The documentation at http://turfjs.org/docs/#intersect says that intersect returns undefined for empty intersections, but it seems that it now returns an empty Feature instead, since 4.7.1.

I guess that should have been a major version update, since that is a breaking change. It breaks what is explicitly documented (so intersect(a, b) === undefined does not work anymore), and related idioms (like intersect(a, b) || c).

@DenisCarriere
Copy link
Member

DenisCarriere commented Sep 18, 2017

Agreed, I don't remember the exact reason why this was changed (strangely it was me who made that change fd592c0).

I personally prefer this type of idiom intersects(a, b) || c.

Additionally, the output was change from undefined to null from @stebogit (edit ea9551d)

🤔 ... I would have no issues reverting this change back to null (or undefined) instead of returning a Feature with null geometry.

@stebogit your thoughts?

@DenisCarriere
Copy link
Member

This change should also reflect @turf/difference

@stebogit
Copy link
Collaborator

@DenisCarriere @ricardo-kagawa I am not a big fan of Feature<null> either. Also, I would say in this case it's more appropriate returning null (which in my understanding means "none") instead of undefined (like "undetermined).
Good job @DenisCarriere!

This change should also reflect @turf/difference

We should definitely update @turf/difference as well 👍

@DenisCarriere
Copy link
Member

Both libraries have been published to reflect null returns.

@DenisCarriere DenisCarriere modified the milestones: 4.8.0, 5.0.0 Sep 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants