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

turf-voronoi - retain properties from points #2421

Merged
merged 6 commits into from
Nov 29, 2023
Merged

Conversation

maral
Copy link
Contributor

@maral maral commented Apr 1, 2023

Resolves #1450, voronoi now retains properties from the geoJson points as default, no option required.

  • [ X ] Use a meaningful title for the pull request. Include the name of the package modified.
  • [ X ] Have read How To Contribute.
  • [ X ] Run npm test at the sub modules where changes have occurred.
  • [ X ] Run npm run lint to ensure code style at the turf module level.

@maral
Copy link
Contributor Author

maral commented Oct 23, 2023

Is this repo alive? What do I have to do to get the review?

@smallsaucepan
Copy link
Member

Hi @maral. Yes the repo is still alive, and working toward a v7 release. Everyone here is doing their best so apologies we haven't gotten to your PR yet. No one wants to see your work go to waste. Will take a look for you and get this in when we can. Cheers

@maral
Copy link
Contributor Author

maral commented Oct 24, 2023

Thanks for the response, appreciate it. I didn't want to be rude, but I kept checking on the PR every now and then, I guess I could have asked earlier :) Keep up the good work!

@smallsaucepan
Copy link
Member

All good. Took a look at the PR and have an idea would like your thoughts on.

Rather than JSON stringify + parse to deep copy the props, what if we were to make cloneProperties() available outside turf-clone and use that? Might head off performance / memory problems if someone throws in a point with a million properties on it.

Also happy to submit this as is and revisit the performance if / when someone runs into a problem.

@maral
Copy link
Contributor Author

maral commented Oct 25, 2023

Thanks! Of course, I would rather use cloneProperties, performance is key in this function and this would slow down (and will slow anyway, but less) also for all the people that don't need to retain the properties. I'll try to send the fix ASAP.

@maral
Copy link
Contributor Author

maral commented Nov 5, 2023

Hi @smallsaucepan, I finally found time to finalize this and I am not sure what the best approach is here - in CONTRIBUTING, there is this little sentence:

Turf modules are small, containing a single exported function.

If I used cloneProperties, it would break this premise. Is it okay to just add the export keyword and all is good, or is there some convention how to do this properly?

@smallsaucepan
Copy link
Member

Hi @maral. Keeping it to one function per module is generally true and been a worthwhile design goal. It's probably overkill though to separate the prop cloning into it's own module, especially as it's a clear subset of cloning a whole object. Making it a named export (as you have) is a good balance. Will review and try to get it merged.

@smallsaucepan smallsaucepan merged commit ba35a93 into Turfjs:master Nov 29, 2023
3 checks passed
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.

Add option to voronoi to retain properties
2 participants