@turf/flip 7.1.0 → 7.2.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.
@@ -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
- throw new Error("geojson is required");
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];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts"],"names":[],"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;AAAG,UAAM,IAAI,MAAM,oBAAoB;AAC5D,QAAM,UAAS,aAAQ,WAAR,YAAkB;AAEjC,MAAI,CAAC;AAAS,UAAM,IAAI,MAAM,qBAAqB;AAInD,MAAI,WAAW,SAAS,WAAW;AAAW,cAAU,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,oBAAQ","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 * @name flip\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"]}
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,kBAAA,EAAQ,IAAA;AD3Bf;AACE;AACA;AACF,yDAAC","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"]}
@@ -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
- * @name flip
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)
@@ -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
- * @name flip
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
- throw new Error("geojson is required");
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];
@@ -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 * @name flip\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;AAAG,UAAM,IAAI,MAAM,oBAAoB;AAC5D,QAAM,UAAS,aAAQ,WAAR,YAAkB;AAEjC,MAAI,CAAC;AAAS,UAAM,IAAI,MAAM,qBAAqB;AAInD,MAAI,WAAW,SAAS,WAAW;AAAW,cAAU,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,oBAAQ;","names":[]}
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,oBAAQ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/flip",
3
- "version": "7.1.0",
3
+ "version": "7.2.0",
4
4
  "description": "turf flip module",
5
5
  "author": "Turf Authors",
6
6
  "license": "MIT",
@@ -53,22 +53,22 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/benchmark": "^2.1.5",
56
- "@types/tape": "^4.2.32",
56
+ "@types/tape": "^4.13.4",
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.7.2",
61
- "tsup": "^8.0.1",
62
- "tsx": "^4.6.2",
63
- "typescript": "^5.2.2",
60
+ "tape": "^5.9.0",
61
+ "tsup": "^8.3.5",
62
+ "tsx": "^4.19.2",
63
+ "typescript": "^5.5.4",
64
64
  "write-json-file": "^5.0.0"
65
65
  },
66
66
  "dependencies": {
67
- "@turf/clone": "^7.1.0",
68
- "@turf/helpers": "^7.1.0",
69
- "@turf/meta": "^7.1.0",
67
+ "@turf/clone": "^7.2.0",
68
+ "@turf/helpers": "^7.2.0",
69
+ "@turf/meta": "^7.2.0",
70
70
  "@types/geojson": "^7946.0.10",
71
- "tslib": "^2.6.2"
71
+ "tslib": "^2.8.1"
72
72
  },
73
- "gitHead": "68915eeebc9278bb40dec3f1034499698a0561ef"
73
+ "gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867"
74
74
  }