@turf/clone 7.0.0 → 7.1.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +1 -10
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +0 -9
- package/dist/esm/index.js.map +1 -1
- package/package.json +4 -4
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// index.ts
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// index.ts
|
|
5
2
|
function clone(geojson) {
|
|
6
3
|
if (!geojson) {
|
|
7
4
|
throw new Error("geojson is required");
|
|
@@ -23,7 +20,6 @@ function clone(geojson) {
|
|
|
23
20
|
throw new Error("unknown GeoJSON type");
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
|
-
__name(clone, "clone");
|
|
27
23
|
function cloneFeature(geojson) {
|
|
28
24
|
const cloned = { type: "Feature" };
|
|
29
25
|
Object.keys(geojson).forEach((key) => {
|
|
@@ -44,7 +40,6 @@ function cloneFeature(geojson) {
|
|
|
44
40
|
}
|
|
45
41
|
return cloned;
|
|
46
42
|
}
|
|
47
|
-
__name(cloneFeature, "cloneFeature");
|
|
48
43
|
function cloneProperties(properties) {
|
|
49
44
|
const cloned = {};
|
|
50
45
|
if (!properties) {
|
|
@@ -68,7 +63,6 @@ function cloneProperties(properties) {
|
|
|
68
63
|
});
|
|
69
64
|
return cloned;
|
|
70
65
|
}
|
|
71
|
-
__name(cloneProperties, "cloneProperties");
|
|
72
66
|
function cloneFeatureCollection(geojson) {
|
|
73
67
|
const cloned = { type: "FeatureCollection" };
|
|
74
68
|
Object.keys(geojson).forEach((key) => {
|
|
@@ -85,7 +79,6 @@ function cloneFeatureCollection(geojson) {
|
|
|
85
79
|
});
|
|
86
80
|
return cloned;
|
|
87
81
|
}
|
|
88
|
-
__name(cloneFeatureCollection, "cloneFeatureCollection");
|
|
89
82
|
function cloneGeometry(geometry) {
|
|
90
83
|
const geom = { type: geometry.type };
|
|
91
84
|
if (geometry.bbox) {
|
|
@@ -100,7 +93,6 @@ function cloneGeometry(geometry) {
|
|
|
100
93
|
geom.coordinates = deepSlice(geometry.coordinates);
|
|
101
94
|
return geom;
|
|
102
95
|
}
|
|
103
|
-
__name(cloneGeometry, "cloneGeometry");
|
|
104
96
|
function deepSlice(coords) {
|
|
105
97
|
const cloned = coords;
|
|
106
98
|
if (typeof cloned[0] !== "object") {
|
|
@@ -110,7 +102,6 @@ function deepSlice(coords) {
|
|
|
110
102
|
return deepSlice(coord);
|
|
111
103
|
});
|
|
112
104
|
}
|
|
113
|
-
__name(deepSlice, "deepSlice");
|
|
114
105
|
var turf_clone_default = clone;
|
|
115
106
|
|
|
116
107
|
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";AAeA,SAAS,MAA4B,SAAe;AAClD,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,UAAQ,QAAQ,MAAM;AAAA,IACpB,KAAK;AACH,aAAO,aAAa,OAAO;AAAA,IAC7B,KAAK;AACH,aAAO,uBAAuB,OAAO;AAAA,IACvC,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO,cAAc,OAAO;AAAA,IAC9B;AACE,YAAM,IAAI,MAAM,sBAAsB;AAAA,EAC1C;AACF;AASA,SAAS,aAAa,SAAc;AAClC,QAAM,SAAc,EAAE,MAAM,UAAU;AAEtC,SAAO,KAAK,OAAO,E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AAO;AACT;AASA,SAAS,cAAc,UAAe;AACpC,QAAM,OAAY,EAAE,MAAM,SAAS,KAAK;AACxC,MAAI,SAAS,MAAM;AACjB,SAAK,OAAO,SAAS;AAAA,EACvB;AAEA,MAAI,SAAS,SAAS,sBAAsB;AAC1C,SAAK,aAAa,SAAS,WAAW,IAAI,CAAC,MAAW;AACpD,aAAO,cAAc,CAAC;AAAA,IACxB,CAAC;AACD,WAAO;AAAA,EACT;AACA,OAAK,cAAc,UAAU,SAAS,WAAW;AACjD,SAAO;AACT;AASA,SAAS,UAAqB,QAAc;AAC1C,QAAM,SAAc;AACpB,MAAI,OAAO,OAAO,CAAC,MAAM,UAAU;AACjC,WAAO,OAAO,MAAM;AAAA,EACtB;AACA,SAAO,OAAO,IAAI,CAAC,UAAe;AAChC,WAAO,UAAU,KAAK;AAAA,EACxB,CAAC;AACH;AAGA,IAAO,qBAAQ","sourcesContent":["import { Feature, GeoJsonProperties } from \"geojson\";\nimport { AllGeoJSON } from \"@turf/helpers\";\n\n/**\n * Returns a cloned copy of the passed GeoJSON Object, including possible 'Foreign Members'.\n * ~3-5x faster than the common JSON.parse + JSON.stringify combo method.\n *\n * @name clone\n * @param {GeoJSON} geojson GeoJSON Object\n * @returns {GeoJSON} cloned GeoJSON Object\n * @example\n * var line = turf.lineString([[-74, 40], [-78, 42], [-82, 35]], {color: 'red'});\n *\n * var lineCloned = turf.clone(line);\n */\nfunction clone<T extends AllGeoJSON>(geojson: T): T {\n if (!geojson) {\n throw new Error(\"geojson is required\");\n }\n\n switch (geojson.type) {\n case \"Feature\":\n return cloneFeature(geojson);\n case \"FeatureCollection\":\n return cloneFeatureCollection(geojson);\n case \"Point\":\n case \"LineString\":\n case \"Polygon\":\n case \"MultiPoint\":\n case \"MultiLineString\":\n case \"MultiPolygon\":\n case \"GeometryCollection\":\n return cloneGeometry(geojson);\n default:\n throw new Error(\"unknown GeoJSON type\");\n }\n}\n\n/**\n * Clone Feature\n *\n * @private\n * @param {Feature<any>} geojson GeoJSON Feature\n * @returns {Feature<any>} cloned Feature\n */\nfunction cloneFeature(geojson: any) {\n const cloned: any = { type: \"Feature\" };\n // Preserve Foreign Members\n Object.keys(geojson).forEach((key) => {\n switch (key) {\n case \"type\":\n case \"properties\":\n case \"geometry\":\n return;\n default:\n cloned[key] = geojson[key];\n }\n });\n // Add properties & geometry last\n cloned.properties = cloneProperties(geojson.properties);\n if (geojson.geometry == null) {\n cloned.geometry = null;\n } else {\n cloned.geometry = cloneGeometry(geojson.geometry);\n }\n return cloned;\n}\n\n/**\n * Clone Properties\n *\n * @private\n * @param {Object} properties GeoJSON Properties\n * @returns {Object} cloned Properties\n */\nfunction cloneProperties(properties: GeoJsonProperties) {\n const cloned: { [key: string]: any } = {};\n if (!properties) {\n return cloned;\n }\n Object.keys(properties).forEach((key) => {\n const value = properties[key];\n if (typeof value === \"object\") {\n if (value === null) {\n // handle null\n cloned[key] = null;\n } else if (Array.isArray(value)) {\n // handle Array\n cloned[key] = value.map((item) => {\n return item;\n });\n } else {\n // handle generic Object\n cloned[key] = cloneProperties(value);\n }\n } else {\n cloned[key] = value;\n }\n });\n return cloned;\n}\n\n/**\n * Clone Feature Collection\n *\n * @private\n * @param {FeatureCollection<any>} geojson GeoJSON Feature Collection\n * @returns {FeatureCollection<any>} cloned Feature Collection\n */\nfunction cloneFeatureCollection(geojson: any) {\n const cloned: any = { type: \"FeatureCollection\" };\n\n // Preserve Foreign Members\n Object.keys(geojson).forEach((key) => {\n switch (key) {\n case \"type\":\n case \"features\":\n return;\n default:\n cloned[key] = geojson[key];\n }\n });\n // Add features\n cloned.features = geojson.features.map((feature: Feature<any>) => {\n return cloneFeature(feature);\n });\n return cloned;\n}\n\n/**\n * Clone Geometry\n *\n * @private\n * @param {Geometry<any>} geometry GeoJSON Geometry\n * @returns {Geometry<any>} cloned Geometry\n */\nfunction cloneGeometry(geometry: any) {\n const geom: any = { type: geometry.type };\n if (geometry.bbox) {\n geom.bbox = geometry.bbox;\n }\n\n if (geometry.type === \"GeometryCollection\") {\n geom.geometries = geometry.geometries.map((g: any) => {\n return cloneGeometry(g);\n });\n return geom;\n }\n geom.coordinates = deepSlice(geometry.coordinates);\n return geom;\n}\n\n/**\n * Deep Slice coordinates\n *\n * @private\n * @param {Coordinates} coords Coordinates\n * @returns {Coordinates} all coordinates sliced\n */\nfunction deepSlice<C = any[]>(coords: C): C {\n const cloned: any = coords;\n if (typeof cloned[0] !== \"object\") {\n return cloned.slice();\n }\n return cloned.map((coord: any) => {\n return deepSlice(coord);\n });\n}\n\nexport { clone, cloneProperties };\nexport default clone;\n"]}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// index.ts
|
|
5
2
|
function clone(geojson) {
|
|
6
3
|
if (!geojson) {
|
|
@@ -23,7 +20,6 @@ function clone(geojson) {
|
|
|
23
20
|
throw new Error("unknown GeoJSON type");
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
|
-
__name(clone, "clone");
|
|
27
23
|
function cloneFeature(geojson) {
|
|
28
24
|
const cloned = { type: "Feature" };
|
|
29
25
|
Object.keys(geojson).forEach((key) => {
|
|
@@ -44,7 +40,6 @@ function cloneFeature(geojson) {
|
|
|
44
40
|
}
|
|
45
41
|
return cloned;
|
|
46
42
|
}
|
|
47
|
-
__name(cloneFeature, "cloneFeature");
|
|
48
43
|
function cloneProperties(properties) {
|
|
49
44
|
const cloned = {};
|
|
50
45
|
if (!properties) {
|
|
@@ -68,7 +63,6 @@ function cloneProperties(properties) {
|
|
|
68
63
|
});
|
|
69
64
|
return cloned;
|
|
70
65
|
}
|
|
71
|
-
__name(cloneProperties, "cloneProperties");
|
|
72
66
|
function cloneFeatureCollection(geojson) {
|
|
73
67
|
const cloned = { type: "FeatureCollection" };
|
|
74
68
|
Object.keys(geojson).forEach((key) => {
|
|
@@ -85,7 +79,6 @@ function cloneFeatureCollection(geojson) {
|
|
|
85
79
|
});
|
|
86
80
|
return cloned;
|
|
87
81
|
}
|
|
88
|
-
__name(cloneFeatureCollection, "cloneFeatureCollection");
|
|
89
82
|
function cloneGeometry(geometry) {
|
|
90
83
|
const geom = { type: geometry.type };
|
|
91
84
|
if (geometry.bbox) {
|
|
@@ -100,7 +93,6 @@ function cloneGeometry(geometry) {
|
|
|
100
93
|
geom.coordinates = deepSlice(geometry.coordinates);
|
|
101
94
|
return geom;
|
|
102
95
|
}
|
|
103
|
-
__name(cloneGeometry, "cloneGeometry");
|
|
104
96
|
function deepSlice(coords) {
|
|
105
97
|
const cloned = coords;
|
|
106
98
|
if (typeof cloned[0] !== "object") {
|
|
@@ -110,7 +102,6 @@ function deepSlice(coords) {
|
|
|
110
102
|
return deepSlice(coord);
|
|
111
103
|
});
|
|
112
104
|
}
|
|
113
|
-
__name(deepSlice, "deepSlice");
|
|
114
105
|
var turf_clone_default = clone;
|
|
115
106
|
export {
|
|
116
107
|
clone,
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { Feature, GeoJsonProperties } from \"geojson\";\nimport { AllGeoJSON } from \"@turf/helpers\";\n\n/**\n * Returns a cloned copy of the passed GeoJSON Object, including possible 'Foreign Members'.\n * ~3-5x faster than the common JSON.parse + JSON.stringify combo method.\n *\n * @name clone\n * @param {GeoJSON} geojson GeoJSON Object\n * @returns {GeoJSON} cloned GeoJSON Object\n * @example\n * var line = turf.lineString([[-74, 40], [-78, 42], [-82, 35]], {color: 'red'});\n *\n * var lineCloned = turf.clone(line);\n */\nfunction clone<T extends AllGeoJSON>(geojson: T): T {\n if (!geojson) {\n throw new Error(\"geojson is required\");\n }\n\n switch (geojson.type) {\n case \"Feature\":\n return cloneFeature(geojson);\n case \"FeatureCollection\":\n return cloneFeatureCollection(geojson);\n case \"Point\":\n case \"LineString\":\n case \"Polygon\":\n case \"MultiPoint\":\n case \"MultiLineString\":\n case \"MultiPolygon\":\n case \"GeometryCollection\":\n return cloneGeometry(geojson);\n default:\n throw new Error(\"unknown GeoJSON type\");\n }\n}\n\n/**\n * Clone Feature\n *\n * @private\n * @param {Feature<any>} geojson GeoJSON Feature\n * @returns {Feature<any>} cloned Feature\n */\nfunction cloneFeature(geojson: any) {\n const cloned: any = { type: \"Feature\" };\n // Preserve Foreign Members\n Object.keys(geojson).forEach((key) => {\n switch (key) {\n case \"type\":\n case \"properties\":\n case \"geometry\":\n return;\n default:\n cloned[key] = geojson[key];\n }\n });\n // Add properties & geometry last\n cloned.properties = cloneProperties(geojson.properties);\n if (geojson.geometry == null) {\n cloned.geometry = null;\n } else {\n cloned.geometry = cloneGeometry(geojson.geometry);\n }\n return cloned;\n}\n\n/**\n * Clone Properties\n *\n * @private\n * @param {Object} properties GeoJSON Properties\n * @returns {Object} cloned Properties\n */\nfunction cloneProperties(properties: GeoJsonProperties) {\n const cloned: { [key: string]: any } = {};\n if (!properties) {\n return cloned;\n }\n Object.keys(properties).forEach((key) => {\n const value = properties[key];\n if (typeof value === \"object\") {\n if (value === null) {\n // handle null\n cloned[key] = null;\n } else if (Array.isArray(value)) {\n // handle Array\n cloned[key] = value.map((item) => {\n return item;\n });\n } else {\n // handle generic Object\n cloned[key] = cloneProperties(value);\n }\n } else {\n cloned[key] = value;\n }\n });\n return cloned;\n}\n\n/**\n * Clone Feature Collection\n *\n * @private\n * @param {FeatureCollection<any>} geojson GeoJSON Feature Collection\n * @returns {FeatureCollection<any>} cloned Feature Collection\n */\nfunction cloneFeatureCollection(geojson: any) {\n const cloned: any = { type: \"FeatureCollection\" };\n\n // Preserve Foreign Members\n Object.keys(geojson).forEach((key) => {\n switch (key) {\n case \"type\":\n case \"features\":\n return;\n default:\n cloned[key] = geojson[key];\n }\n });\n // Add features\n cloned.features = geojson.features.map((feature: Feature<any>) => {\n return cloneFeature(feature);\n });\n return cloned;\n}\n\n/**\n * Clone Geometry\n *\n * @private\n * @param {Geometry<any>} geometry GeoJSON Geometry\n * @returns {Geometry<any>} cloned Geometry\n */\nfunction cloneGeometry(geometry: any) {\n const geom: any = { type: geometry.type };\n if (geometry.bbox) {\n geom.bbox = geometry.bbox;\n }\n\n if (geometry.type === \"GeometryCollection\") {\n geom.geometries = geometry.geometries.map((g: any) => {\n return cloneGeometry(g);\n });\n return geom;\n }\n geom.coordinates = deepSlice(geometry.coordinates);\n return geom;\n}\n\n/**\n * Deep Slice coordinates\n *\n * @private\n * @param {Coordinates} coords Coordinates\n * @returns {Coordinates} all coordinates sliced\n */\nfunction deepSlice<C = any[]>(coords: C): C {\n const cloned: any = coords;\n if (typeof cloned[0] !== \"object\") {\n return cloned.slice();\n }\n return cloned.map((coord: any) => {\n return deepSlice(coord);\n });\n}\n\nexport { clone, cloneProperties };\nexport default clone;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { Feature, GeoJsonProperties } from \"geojson\";\nimport { AllGeoJSON } from \"@turf/helpers\";\n\n/**\n * Returns a cloned copy of the passed GeoJSON Object, including possible 'Foreign Members'.\n * ~3-5x faster than the common JSON.parse + JSON.stringify combo method.\n *\n * @name clone\n * @param {GeoJSON} geojson GeoJSON Object\n * @returns {GeoJSON} cloned GeoJSON Object\n * @example\n * var line = turf.lineString([[-74, 40], [-78, 42], [-82, 35]], {color: 'red'});\n *\n * var lineCloned = turf.clone(line);\n */\nfunction clone<T extends AllGeoJSON>(geojson: T): T {\n if (!geojson) {\n throw new Error(\"geojson is required\");\n }\n\n switch (geojson.type) {\n case \"Feature\":\n return cloneFeature(geojson);\n case \"FeatureCollection\":\n return cloneFeatureCollection(geojson);\n case \"Point\":\n case \"LineString\":\n case \"Polygon\":\n case \"MultiPoint\":\n case \"MultiLineString\":\n case \"MultiPolygon\":\n case \"GeometryCollection\":\n return cloneGeometry(geojson);\n default:\n throw new Error(\"unknown GeoJSON type\");\n }\n}\n\n/**\n * Clone Feature\n *\n * @private\n * @param {Feature<any>} geojson GeoJSON Feature\n * @returns {Feature<any>} cloned Feature\n */\nfunction cloneFeature(geojson: any) {\n const cloned: any = { type: \"Feature\" };\n // Preserve Foreign Members\n Object.keys(geojson).forEach((key) => {\n switch (key) {\n case \"type\":\n case \"properties\":\n case \"geometry\":\n return;\n default:\n cloned[key] = geojson[key];\n }\n });\n // Add properties & geometry last\n cloned.properties = cloneProperties(geojson.properties);\n if (geojson.geometry == null) {\n cloned.geometry = null;\n } else {\n cloned.geometry = cloneGeometry(geojson.geometry);\n }\n return cloned;\n}\n\n/**\n * Clone Properties\n *\n * @private\n * @param {Object} properties GeoJSON Properties\n * @returns {Object} cloned Properties\n */\nfunction cloneProperties(properties: GeoJsonProperties) {\n const cloned: { [key: string]: any } = {};\n if (!properties) {\n return cloned;\n }\n Object.keys(properties).forEach((key) => {\n const value = properties[key];\n if (typeof value === \"object\") {\n if (value === null) {\n // handle null\n cloned[key] = null;\n } else if (Array.isArray(value)) {\n // handle Array\n cloned[key] = value.map((item) => {\n return item;\n });\n } else {\n // handle generic Object\n cloned[key] = cloneProperties(value);\n }\n } else {\n cloned[key] = value;\n }\n });\n return cloned;\n}\n\n/**\n * Clone Feature Collection\n *\n * @private\n * @param {FeatureCollection<any>} geojson GeoJSON Feature Collection\n * @returns {FeatureCollection<any>} cloned Feature Collection\n */\nfunction cloneFeatureCollection(geojson: any) {\n const cloned: any = { type: \"FeatureCollection\" };\n\n // Preserve Foreign Members\n Object.keys(geojson).forEach((key) => {\n switch (key) {\n case \"type\":\n case \"features\":\n return;\n default:\n cloned[key] = geojson[key];\n }\n });\n // Add features\n cloned.features = geojson.features.map((feature: Feature<any>) => {\n return cloneFeature(feature);\n });\n return cloned;\n}\n\n/**\n * Clone Geometry\n *\n * @private\n * @param {Geometry<any>} geometry GeoJSON Geometry\n * @returns {Geometry<any>} cloned Geometry\n */\nfunction cloneGeometry(geometry: any) {\n const geom: any = { type: geometry.type };\n if (geometry.bbox) {\n geom.bbox = geometry.bbox;\n }\n\n if (geometry.type === \"GeometryCollection\") {\n geom.geometries = geometry.geometries.map((g: any) => {\n return cloneGeometry(g);\n });\n return geom;\n }\n geom.coordinates = deepSlice(geometry.coordinates);\n return geom;\n}\n\n/**\n * Deep Slice coordinates\n *\n * @private\n * @param {Coordinates} coords Coordinates\n * @returns {Coordinates} all coordinates sliced\n */\nfunction deepSlice<C = any[]>(coords: C): C {\n const cloned: any = coords;\n if (typeof cloned[0] !== \"object\") {\n return cloned.slice();\n }\n return cloned.map((coord: any) => {\n return deepSlice(coord);\n });\n}\n\nexport { clone, cloneProperties };\nexport default clone;\n"],"mappings":";AAeA,SAAS,MAA4B,SAAe;AAClD,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,UAAQ,QAAQ,MAAM;AAAA,IACpB,KAAK;AACH,aAAO,aAAa,OAAO;AAAA,IAC7B,KAAK;AACH,aAAO,uBAAuB,OAAO;AAAA,IACvC,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO,cAAc,OAAO;AAAA,IAC9B;AACE,YAAM,IAAI,MAAM,sBAAsB;AAAA,EAC1C;AACF;AASA,SAAS,aAAa,SAAc;AAClC,QAAM,SAAc,EAAE,MAAM,UAAU;AAEtC,SAAO,KAAK,OAAO,EAAE,QAAQ,CAAC,QAAQ;AACpC,YAAQ,KAAK;AAAA,MACX,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AACH;AAAA,MACF;AACE,eAAO,GAAG,IAAI,QAAQ,GAAG;AAAA,IAC7B;AAAA,EACF,CAAC;AAED,SAAO,aAAa,gBAAgB,QAAQ,UAAU;AACtD,MAAI,QAAQ,YAAY,MAAM;AAC5B,WAAO,WAAW;AAAA,EACpB,OAAO;AACL,WAAO,WAAW,cAAc,QAAQ,QAAQ;AAAA,EAClD;AACA,S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AS,UAAqB,QAAc;AAC1C,QAAM,SAAc;AACpB,MAAI,OAAO,OAAO,CAAC,MAAM,UAAU;AACjC,WAAO,OAAO,MAAM;AAAA,EACtB;AACA,SAAO,OAAO,IAAI,CAAC,UAAe;AAChC,WAAO,UAAU,KAAK;AAAA,EACxB,CAAC;AACH;AAGA,IAAO,qBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/clone",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.1.0-alpha.7+0ce6ecca0",
|
|
4
4
|
"description": "turf clone module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@turf/meta": "^7.0.
|
|
56
|
+
"@turf/meta": "^7.1.0-alpha.7+0ce6ecca0",
|
|
57
57
|
"@types/benchmark": "^2.1.5",
|
|
58
58
|
"@types/tape": "^4.2.32",
|
|
59
59
|
"benchmark": "^2.1.4",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"typescript": "^5.2.2"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@turf/helpers": "^7.0.
|
|
67
|
+
"@turf/helpers": "^7.1.0-alpha.7+0ce6ecca0",
|
|
68
68
|
"tslib": "^2.6.2"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "0ce6ecca05829690270fec6d6bed2003495fe0ea"
|
|
71
71
|
}
|