clone
描述
¥Description
Returns a cloned copy of the passed GeoJSON Object, including possible '外来成员'.~3-5x faster than the common JSON.parse + JSON.stringify combo method.
¥Returns a cloned copy of the passed GeoJSON Object, including possible 'Foreign Members'. ~3-5x faster than the common JSON.parse + JSON.stringify combo method.
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
geojson | GeoJSON | GeoJSON 对象 |
返回
¥Returns
GeoJSON 克隆的 GeoJSON 对象
¥GeoJSON cloned GeoJSON Object
示例
¥Examples
var line = turf.lineString(
[
[-74, 40],
[-78, 42],
[-82, 35],
],
{ color: "red" },
);
var lineCloned = turf.clone(line);
安装
¥Installation
$ npm install @turf/clone
import { clone } from "@turf/clone";
const result = clone(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.clone(...);