Package Exports
- @turf/clone
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@turf/clone) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@turf/clone
clone
Prevents GeoJSON coordinates from being mutated, similar to JSON.parse(JSON.stringify(geojson)).
Only cloning coordinates can be 3x-20x faster than the parse + stringify approach.
Parameters
geojsonGeoJSON GeoJSON ObjectcloneAll[Boolean] clones entire GeoJSON (3-20x slower if True) (optional, defaultfalse)
Examples
var line = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [[-74, 40], [-78, 42], [-82, 35]]
}
}
var lineCloned = turf.clone(line);Returns GeoJSON cloned GeoJSON Object
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Installation
Install this module individually:
$ npm install @turf/cloneOr install the Turf module that includes it as a function:
$ npm install @turf/turf