Clarify that coordsMap mutates input

Open
#2,373 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Stale
Domain
documentation

Research direction

Start at the coordEach API description and read how currentCoord and coordIndex are documented, especially for (Multi)Polygon input. Done means the description explicitly explains that modifying currentCoord mutates the input object and clarifies what coordIndex represents.

Written by the indexing model from the issue text.

Description

docs

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.

Dominant language
TypeScript
Stars
10.5k
Forks
1k
Avg merge
1h 11m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Turfjs/turf

All issues in Turfjs/turf

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.