forked from Turfjs/turf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TypeScript declaration to @turf/clean-coords (Turfjs#1608)
- Loading branch information
1 parent
3620b83
commit ebbdf83
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Geometry, Feature } from "@turf/helpers"; | ||
|
||
/** | ||
* Removes redundant coordinates from any GeoJSON Geometry. | ||
* | ||
* @name cleanCoords | ||
* @param {Geometry|Feature} geojson Feature or Geometry | ||
* @param {Object} [options={}] Optional parameters | ||
* @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated | ||
* @returns {Geometry|Feature} the cleaned input Feature/Geometry | ||
* @example | ||
* var line = turf.lineString([[0, 0], [0, 2], [0, 5], [0, 8], [0, 8], [0, 10]]); | ||
* var multiPoint = turf.multiPoint([[0, 0], [0, 0], [2, 2]]); | ||
* | ||
* turf.cleanCoords(line).geometry.coordinates; | ||
* //= [[0, 0], [0, 10]] | ||
* | ||
* turf.cleanCoords(multiPoint).geometry.coordinates; | ||
* //= [[0, 0], [2, 2]] | ||
*/ | ||
export default function cleanCoords<T extends Geometry | Feature>( | ||
geojson: T, | ||
options?: { | ||
mutate?: boolean | ||
} | ||
): T; |