@turf/flip 7.1.0 → 7.3.0
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 +5 -8
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +5 -8
- package/dist/esm/index.js.map +1 -1
- package/package.json +13 -13
package/dist/cjs/index.cjs
CHANGED
|
@@ -5,13 +5,10 @@ var _clone = require('@turf/clone');
|
|
|
5
5
|
function flip(geojson, options) {
|
|
6
6
|
var _a;
|
|
7
7
|
options = options || {};
|
|
8
|
-
if (!_helpers.isObject.call(void 0, options))
|
|
9
|
-
throw new Error("options is invalid");
|
|
8
|
+
if (!_helpers.isObject.call(void 0, options)) throw new Error("options is invalid");
|
|
10
9
|
const mutate = (_a = options.mutate) != null ? _a : false;
|
|
11
|
-
if (!geojson)
|
|
12
|
-
|
|
13
|
-
if (mutate === false || mutate === void 0)
|
|
14
|
-
geojson = _clone.clone.call(void 0, geojson);
|
|
10
|
+
if (!geojson) throw new Error("geojson is required");
|
|
11
|
+
if (mutate === false || mutate === void 0) geojson = _clone.clone.call(void 0, geojson);
|
|
15
12
|
_meta.coordEach.call(void 0, geojson, function(coord) {
|
|
16
13
|
var x = coord[0];
|
|
17
14
|
var y = coord[1];
|
|
@@ -20,9 +17,9 @@ function flip(geojson, options) {
|
|
|
20
17
|
});
|
|
21
18
|
return geojson;
|
|
22
19
|
}
|
|
23
|
-
var
|
|
20
|
+
var index_default = flip;
|
|
24
21
|
|
|
25
22
|
|
|
26
23
|
|
|
27
|
-
exports.default =
|
|
24
|
+
exports.default = index_default; exports.flip = flip;
|
|
28
25
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-flip/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACAA,kCAA0B;AAC1B,wCAAqC;AACrC,oCAAsB;AAkBtB,SAAS,IAAA,CACP,OAAA,EACA,OAAA,EAGG;AAzBL,EAAA,IAAA,EAAA;AA2BE,EAAA,QAAA,EAAU,QAAA,GAAW,CAAC,CAAA;AACtB,EAAA,GAAA,CAAI,CAAC,+BAAA,OAAgB,CAAA,EAAG,MAAM,IAAI,KAAA,CAAM,oBAAoB,CAAA;AAC5D,EAAA,MAAM,OAAA,EAAA,CAAS,GAAA,EAAA,OAAA,CAAQ,MAAA,EAAA,GAAR,KAAA,EAAA,GAAA,EAAkB,KAAA;AAEjC,EAAA,GAAA,CAAI,CAAC,OAAA,EAAS,MAAM,IAAI,KAAA,CAAM,qBAAqB,CAAA;AAInD,EAAA,GAAA,CAAI,OAAA,IAAW,MAAA,GAAS,OAAA,IAAW,KAAA,CAAA,EAAW,QAAA,EAAU,0BAAA,OAAa,CAAA;AAErE,EAAA,6BAAA,OAAU,EAAS,QAAA,CAAU,KAAA,EAAO;AAClC,IAAA,IAAI,EAAA,EAAI,KAAA,CAAM,CAAC,CAAA;AACf,IAAA,IAAI,EAAA,EAAI,KAAA,CAAM,CAAC,CAAA;AACf,IAAA,KAAA,CAAM,CAAC,EAAA,EAAI,CAAA;AACX,IAAA,KAAA,CAAM,CAAC,EAAA,EAAI,CAAA;AAAA,EACb,CAAC,CAAA;AACD,EAAA,OAAO,OAAA;AACT;AAGA,IAAO,cAAA,EAAQ,IAAA;AD3Bf;AACE;AACA;AACF,qDAAC","file":"/home/runner/work/turf/turf/packages/turf-flip/dist/cjs/index.cjs","sourcesContent":[null,"import { coordEach } from \"@turf/meta\";\nimport { isObject, AllGeoJSON } from \"@turf/helpers\";\nimport { clone } from \"@turf/clone\";\n\n/**\n * Takes input features and flips all of their coordinates from `[x, y]` to `[y, x]`.\n *\n * @function\n * @param {GeoJSON} geojson input features\n * @param {Object} [options={}] Optional parameters\n * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)\n * @returns {GeoJSON} a feature or set of features of the same type as `input` with flipped coordinates\n * @example\n * var serbia = turf.point([20.566406, 43.421008]);\n *\n * var saudiArabia = turf.flip(serbia);\n *\n * //addToMap\n * var addToMap = [serbia, saudiArabia];\n */\nfunction flip<T extends AllGeoJSON>(\n geojson: T,\n options?: {\n mutate?: boolean;\n }\n): T {\n // Optional parameters\n options = options || {};\n if (!isObject(options)) throw new Error(\"options is invalid\");\n const mutate = options.mutate ?? false;\n\n if (!geojson) throw new Error(\"geojson is required\");\n // ensure that we don't modify features in-place and changes to the\n // output do not change the previous feature, including changes to nested\n // properties.\n if (mutate === false || mutate === undefined) geojson = clone(geojson);\n\n coordEach(geojson, function (coord) {\n var x = coord[0];\n var y = coord[1];\n coord[0] = y;\n coord[1] = x;\n });\n return geojson;\n}\n\nexport { flip };\nexport default flip;\n"]}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import { AllGeoJSON } from '@turf/helpers';
|
|
|
3
3
|
/**
|
|
4
4
|
* Takes input features and flips all of their coordinates from `[x, y]` to `[y, x]`.
|
|
5
5
|
*
|
|
6
|
-
* @
|
|
6
|
+
* @function
|
|
7
7
|
* @param {GeoJSON} geojson input features
|
|
8
8
|
* @param {Object} [options={}] Optional parameters
|
|
9
9
|
* @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { AllGeoJSON } from '@turf/helpers';
|
|
|
3
3
|
/**
|
|
4
4
|
* Takes input features and flips all of their coordinates from `[x, y]` to `[y, x]`.
|
|
5
5
|
*
|
|
6
|
-
* @
|
|
6
|
+
* @function
|
|
7
7
|
* @param {GeoJSON} geojson input features
|
|
8
8
|
* @param {Object} [options={}] Optional parameters
|
|
9
9
|
* @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)
|
package/dist/esm/index.js
CHANGED
|
@@ -5,13 +5,10 @@ import { clone } from "@turf/clone";
|
|
|
5
5
|
function flip(geojson, options) {
|
|
6
6
|
var _a;
|
|
7
7
|
options = options || {};
|
|
8
|
-
if (!isObject(options))
|
|
9
|
-
throw new Error("options is invalid");
|
|
8
|
+
if (!isObject(options)) throw new Error("options is invalid");
|
|
10
9
|
const mutate = (_a = options.mutate) != null ? _a : false;
|
|
11
|
-
if (!geojson)
|
|
12
|
-
|
|
13
|
-
if (mutate === false || mutate === void 0)
|
|
14
|
-
geojson = clone(geojson);
|
|
10
|
+
if (!geojson) throw new Error("geojson is required");
|
|
11
|
+
if (mutate === false || mutate === void 0) geojson = clone(geojson);
|
|
15
12
|
coordEach(geojson, function(coord) {
|
|
16
13
|
var x = coord[0];
|
|
17
14
|
var y = coord[1];
|
|
@@ -20,9 +17,9 @@ function flip(geojson, options) {
|
|
|
20
17
|
});
|
|
21
18
|
return geojson;
|
|
22
19
|
}
|
|
23
|
-
var
|
|
20
|
+
var index_default = flip;
|
|
24
21
|
export {
|
|
25
|
-
|
|
22
|
+
index_default as default,
|
|
26
23
|
flip
|
|
27
24
|
};
|
|
28
25
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { coordEach } from \"@turf/meta\";\nimport { isObject, AllGeoJSON } from \"@turf/helpers\";\nimport { clone } from \"@turf/clone\";\n\n/**\n * Takes input features and flips all of their coordinates from `[x, y]` to `[y, x]`.\n *\n * @
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { coordEach } from \"@turf/meta\";\nimport { isObject, AllGeoJSON } from \"@turf/helpers\";\nimport { clone } from \"@turf/clone\";\n\n/**\n * Takes input features and flips all of their coordinates from `[x, y]` to `[y, x]`.\n *\n * @function\n * @param {GeoJSON} geojson input features\n * @param {Object} [options={}] Optional parameters\n * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)\n * @returns {GeoJSON} a feature or set of features of the same type as `input` with flipped coordinates\n * @example\n * var serbia = turf.point([20.566406, 43.421008]);\n *\n * var saudiArabia = turf.flip(serbia);\n *\n * //addToMap\n * var addToMap = [serbia, saudiArabia];\n */\nfunction flip<T extends AllGeoJSON>(\n geojson: T,\n options?: {\n mutate?: boolean;\n }\n): T {\n // Optional parameters\n options = options || {};\n if (!isObject(options)) throw new Error(\"options is invalid\");\n const mutate = options.mutate ?? false;\n\n if (!geojson) throw new Error(\"geojson is required\");\n // ensure that we don't modify features in-place and changes to the\n // output do not change the previous feature, including changes to nested\n // properties.\n if (mutate === false || mutate === undefined) geojson = clone(geojson);\n\n coordEach(geojson, function (coord) {\n var x = coord[0];\n var y = coord[1];\n coord[0] = y;\n coord[1] = x;\n });\n return geojson;\n}\n\nexport { flip };\nexport default flip;\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAAS,gBAA4B;AACrC,SAAS,aAAa;AAkBtB,SAAS,KACP,SACA,SAGG;AAzBL;AA2BE,YAAU,WAAW,CAAC;AACtB,MAAI,CAAC,SAAS,OAAO,EAAG,OAAM,IAAI,MAAM,oBAAoB;AAC5D,QAAM,UAAS,aAAQ,WAAR,YAAkB;AAEjC,MAAI,CAAC,QAAS,OAAM,IAAI,MAAM,qBAAqB;AAInD,MAAI,WAAW,SAAS,WAAW,OAAW,WAAU,MAAM,OAAO;AAErE,YAAU,SAAS,SAAU,OAAO;AAClC,QAAI,IAAI,MAAM,CAAC;AACf,QAAI,IAAI,MAAM,CAAC;AACf,UAAM,CAAC,IAAI;AACX,UAAM,CAAC,IAAI;AAAA,EACb,CAAC;AACD,SAAO;AACT;AAGA,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/flip",
|
|
3
|
-
"version": "7.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "7.3.0",
|
|
4
|
+
"description": "Takes input features and flips all of their coordinates.",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bugs": {
|
|
@@ -53,22 +53,22 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/benchmark": "^2.1.5",
|
|
56
|
-
"@types/tape": "^
|
|
56
|
+
"@types/tape": "^5.8.1",
|
|
57
57
|
"benchmark": "^2.1.4",
|
|
58
58
|
"load-json-file": "^7.0.1",
|
|
59
59
|
"npm-run-all": "^4.1.5",
|
|
60
|
-
"tape": "^5.
|
|
61
|
-
"tsup": "^8.0
|
|
62
|
-
"tsx": "^4.
|
|
63
|
-
"typescript": "^5.
|
|
64
|
-
"write-json-file": "^
|
|
60
|
+
"tape": "^5.9.0",
|
|
61
|
+
"tsup": "^8.4.0",
|
|
62
|
+
"tsx": "^4.19.4",
|
|
63
|
+
"typescript": "^5.8.3",
|
|
64
|
+
"write-json-file": "^6.0.0"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@turf/clone": "
|
|
68
|
-
"@turf/helpers": "
|
|
69
|
-
"@turf/meta": "
|
|
67
|
+
"@turf/clone": "7.3.0",
|
|
68
|
+
"@turf/helpers": "7.3.0",
|
|
69
|
+
"@turf/meta": "7.3.0",
|
|
70
70
|
"@types/geojson": "^7946.0.10",
|
|
71
|
-
"tslib": "^2.
|
|
71
|
+
"tslib": "^2.8.1"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "9f58a103e8f9a587ab640307ed03ba5233913ddd"
|
|
74
74
|
}
|