Skip to content

KBE3D / KBCore / turf / clone

函数: clone()

clone<T>(geojson: T): T

Function

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.

类型参数

T

T extends AllGeoJSON

参数

geojson

T

GeoJSON Object

返回

T

cloned GeoJSON Object

示例

ts
var line = turf.lineString([[-74, 40], [-78, 42], [-82, 35]], {color: 'red'});

var lineCloned = turf.clone(line);

KBE3D @3.0.0 Copyright © 2024-present KBE3D