turf icon indicating copy to clipboard operation
turf copied to clipboard

Clarify that coordsMap mutates input

Open stevage opened this issue 3 years ago • 1 comments

I was looking for a way to transform each coordinate of a GeoJSON object and was about to propose .coordMap() (similar to #1438).

It was only by reading through the comments that I realised that .coordEach() can be used to do in-place transformation.

I'd suggest updating the description from:

Iterate over coordinates in any GeoJSON object, similar to Array.forEach()

to:

Iterate over coordinates in any GeoJSON object, analogous to Array.forEach(). Modifications to currentCoord mutate the input object.

(IMHO "analogous" is a better word here than "similar" because of the different arguments and input type)

Also, if possible, clarify what coordIndex is, because it's not that obvious to me in the case of a (Multi)Polygon.

stevage avatar Nov 28 '22 03:11 stevage

Also this line of the documentation is a bit confusing:

whether or not to include the final coordinate of LinearRings that wraps the ring in its iteration. (default false)

IMHO the word include should be replaced with exclude to match the option name.

stevage avatar Jan 17 '25 04:01 stevage