@turf/flatten 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.
@@ -2,8 +2,7 @@
2
2
  var _meta = require('@turf/meta');
3
3
  var _helpers = require('@turf/helpers');
4
4
  function flatten(geojson) {
5
- if (!geojson)
6
- throw new Error("geojson is required");
5
+ if (!geojson) throw new Error("geojson is required");
7
6
  var results = [];
8
7
  _meta.flattenEach.call(void 0, geojson, function(feature) {
9
8
  results.push(feature);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts"],"names":[],"mappings":";AAAA,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AA6ClC,SAAS,QAAQ,SAAwC;AACvD,MAAI,CAAC;AAAS,UAAM,IAAI,MAAM,qBAAqB;AAEnD,MAAI,UAAqB,CAAC;AAC1B,cAAY,SAAS,SAAU,SAAS;AACtC,YAAQ,KAAK,OAAO;AAAA,EACtB,CAAC;AACD,SAAO,kBAAkB,OAAO;AAClC;AAGA,IAAO,uBAAQ","sourcesContent":["import { flattenEach } from \"@turf/meta\";\nimport { featureCollection } from \"@turf/helpers\";\nimport type { AllGeoJSON } from \"@turf/helpers\";\nimport type {\n Feature,\n Point,\n MultiPoint,\n LineString,\n MultiLineString,\n FeatureCollection,\n Polygon,\n MultiPolygon,\n} from \"geojson\";\n\n/**\n * Flattens any {@link GeoJSON} to a {@link FeatureCollection} inspired by [geojson-flatten](https://github.com/tmcw/geojson-flatten).\n *\n * @name flatten\n * @param {GeoJSON} geojson any valid GeoJSON Object\n * @returns {FeatureCollection<any>} all Multi-Geometries are flattened into single Features\n * @example\n * var multiGeometry = turf.multiPolygon([\n * [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],\n * [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],\n * [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]\n * ]);\n *\n * var flatten = turf.flatten(multiGeometry);\n *\n * //addToMap\n * var addToMap = [flatten]\n */\nfunction flatten<T extends Point | MultiPoint>(\n geojson: Feature<T> | FeatureCollection<T> | T\n): FeatureCollection<Point>;\n\nfunction flatten<T extends LineString | MultiLineString>(\n geojson: Feature<T> | FeatureCollection<T> | T\n): FeatureCollection<LineString>;\n\nfunction flatten<T extends Polygon | MultiPolygon>(\n geojson: Feature<T> | FeatureCollection<T> | T\n): FeatureCollection<Polygon>;\n\nfunction flatten(geojson: AllGeoJSON): FeatureCollection<any>;\n\nfunction flatten(geojson: AllGeoJSON): FeatureCollection {\n if (!geojson) throw new Error(\"geojson is required\");\n\n var results: Feature[] = [];\n flattenEach(geojson, function (feature) {\n results.push(feature);\n });\n return featureCollection(results);\n}\n\nexport { flatten };\nexport default flatten;\n"]}
1
+ {"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-flatten/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACAA,kCAA4B;AAC5B,wCAAkC;AA6ClC,SAAS,OAAA,CAAQ,OAAA,EAAwC;AACvD,EAAA,GAAA,CAAI,CAAC,OAAA,EAAS,MAAM,IAAI,KAAA,CAAM,qBAAqB,CAAA;AAEnD,EAAA,IAAI,QAAA,EAAqB,CAAC,CAAA;AAC1B,EAAA,+BAAA,OAAY,EAAS,QAAA,CAAU,OAAA,EAAS;AACtC,IAAA,OAAA,CAAQ,IAAA,CAAK,OAAO,CAAA;AAAA,EACtB,CAAC,CAAA;AACD,EAAA,OAAO,wCAAA,OAAyB,CAAA;AAClC;AAGA,IAAO,qBAAA,EAAQ,OAAA;AD7Cf;AACE;AACA;AACF,kEAAC","file":"/home/runner/work/turf/turf/packages/turf-flatten/dist/cjs/index.cjs","sourcesContent":[null,"import { flattenEach } from \"@turf/meta\";\nimport { featureCollection } from \"@turf/helpers\";\nimport type { AllGeoJSON } from \"@turf/helpers\";\nimport type {\n Feature,\n Point,\n MultiPoint,\n LineString,\n MultiLineString,\n FeatureCollection,\n Polygon,\n MultiPolygon,\n} from \"geojson\";\n\n/**\n * Flattens any {@link GeoJSON} to a {@link FeatureCollection} inspired by [geojson-flatten](https://github.com/tmcw/geojson-flatten).\n *\n * @function\n * @param {GeoJSON} geojson any valid GeoJSON Object\n * @returns {FeatureCollection<any>} all Multi-Geometries are flattened into single Features\n * @example\n * var multiGeometry = turf.multiPolygon([\n * [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],\n * [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],\n * [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]\n * ]);\n *\n * var flatten = turf.flatten(multiGeometry);\n *\n * //addToMap\n * var addToMap = [flatten]\n */\nfunction flatten<T extends Point | MultiPoint>(\n geojson: Feature<T> | FeatureCollection<T> | T\n): FeatureCollection<Point>;\n\nfunction flatten<T extends LineString | MultiLineString>(\n geojson: Feature<T> | FeatureCollection<T> | T\n): FeatureCollection<LineString>;\n\nfunction flatten<T extends Polygon | MultiPolygon>(\n geojson: Feature<T> | FeatureCollection<T> | T\n): FeatureCollection<Polygon>;\n\nfunction flatten(geojson: AllGeoJSON): FeatureCollection<any>;\n\nfunction flatten(geojson: AllGeoJSON): FeatureCollection {\n if (!geojson) throw new Error(\"geojson is required\");\n\n var results: Feature[] = [];\n flattenEach(geojson, function (feature) {\n results.push(feature);\n });\n return featureCollection(results);\n}\n\nexport { flatten };\nexport default flatten;\n"]}
@@ -4,7 +4,7 @@ import { Point, MultiPoint, Feature, FeatureCollection, LineString, MultiLineStr
4
4
  /**
5
5
  * Flattens any {@link GeoJSON} to a {@link FeatureCollection} inspired by [geojson-flatten](https://github.com/tmcw/geojson-flatten).
6
6
  *
7
- * @name flatten
7
+ * @function
8
8
  * @param {GeoJSON} geojson any valid GeoJSON Object
9
9
  * @returns {FeatureCollection<any>} all Multi-Geometries are flattened into single Features
10
10
  * @example
@@ -4,7 +4,7 @@ import { Point, MultiPoint, Feature, FeatureCollection, LineString, MultiLineStr
4
4
  /**
5
5
  * Flattens any {@link GeoJSON} to a {@link FeatureCollection} inspired by [geojson-flatten](https://github.com/tmcw/geojson-flatten).
6
6
  *
7
- * @name flatten
7
+ * @function
8
8
  * @param {GeoJSON} geojson any valid GeoJSON Object
9
9
  * @returns {FeatureCollection<any>} all Multi-Geometries are flattened into single Features
10
10
  * @example
package/dist/esm/index.js CHANGED
@@ -2,8 +2,7 @@
2
2
  import { flattenEach } from "@turf/meta";
3
3
  import { featureCollection } from "@turf/helpers";
4
4
  function flatten(geojson) {
5
- if (!geojson)
6
- throw new Error("geojson is required");
5
+ if (!geojson) throw new Error("geojson is required");
7
6
  var results = [];
8
7
  flattenEach(geojson, function(feature) {
9
8
  results.push(feature);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts"],"sourcesContent":["import { flattenEach } from \"@turf/meta\";\nimport { featureCollection } from \"@turf/helpers\";\nimport type { AllGeoJSON } from \"@turf/helpers\";\nimport type {\n Feature,\n Point,\n MultiPoint,\n LineString,\n MultiLineString,\n FeatureCollection,\n Polygon,\n MultiPolygon,\n} from \"geojson\";\n\n/**\n * Flattens any {@link GeoJSON} to a {@link FeatureCollection} inspired by [geojson-flatten](https://github.com/tmcw/geojson-flatten).\n *\n * @name flatten\n * @param {GeoJSON} geojson any valid GeoJSON Object\n * @returns {FeatureCollection<any>} all Multi-Geometries are flattened into single Features\n * @example\n * var multiGeometry = turf.multiPolygon([\n * [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],\n * [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],\n * [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]\n * ]);\n *\n * var flatten = turf.flatten(multiGeometry);\n *\n * //addToMap\n * var addToMap = [flatten]\n */\nfunction flatten<T extends Point | MultiPoint>(\n geojson: Feature<T> | FeatureCollection<T> | T\n): FeatureCollection<Point>;\n\nfunction flatten<T extends LineString | MultiLineString>(\n geojson: Feature<T> | FeatureCollection<T> | T\n): FeatureCollection<LineString>;\n\nfunction flatten<T extends Polygon | MultiPolygon>(\n geojson: Feature<T> | FeatureCollection<T> | T\n): FeatureCollection<Polygon>;\n\nfunction flatten(geojson: AllGeoJSON): FeatureCollection<any>;\n\nfunction flatten(geojson: AllGeoJSON): FeatureCollection {\n if (!geojson) throw new Error(\"geojson is required\");\n\n var results: Feature[] = [];\n flattenEach(geojson, function (feature) {\n results.push(feature);\n });\n return featureCollection(results);\n}\n\nexport { flatten };\nexport default flatten;\n"],"mappings":";AAAA,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AA6ClC,SAAS,QAAQ,SAAwC;AACvD,MAAI,CAAC;AAAS,UAAM,IAAI,MAAM,qBAAqB;AAEnD,MAAI,UAAqB,CAAC;AAC1B,cAAY,SAAS,SAAU,SAAS;AACtC,YAAQ,KAAK,OAAO;AAAA,EACtB,CAAC;AACD,SAAO,kBAAkB,OAAO;AAClC;AAGA,IAAO,uBAAQ;","names":[]}
1
+ {"version":3,"sources":["../../index.ts"],"sourcesContent":["import { flattenEach } from \"@turf/meta\";\nimport { featureCollection } from \"@turf/helpers\";\nimport type { AllGeoJSON } from \"@turf/helpers\";\nimport type {\n Feature,\n Point,\n MultiPoint,\n LineString,\n MultiLineString,\n FeatureCollection,\n Polygon,\n MultiPolygon,\n} from \"geojson\";\n\n/**\n * Flattens any {@link GeoJSON} to a {@link FeatureCollection} inspired by [geojson-flatten](https://github.com/tmcw/geojson-flatten).\n *\n * @function\n * @param {GeoJSON} geojson any valid GeoJSON Object\n * @returns {FeatureCollection<any>} all Multi-Geometries are flattened into single Features\n * @example\n * var multiGeometry = turf.multiPolygon([\n * [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],\n * [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],\n * [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]\n * ]);\n *\n * var flatten = turf.flatten(multiGeometry);\n *\n * //addToMap\n * var addToMap = [flatten]\n */\nfunction flatten<T extends Point | MultiPoint>(\n geojson: Feature<T> | FeatureCollection<T> | T\n): FeatureCollection<Point>;\n\nfunction flatten<T extends LineString | MultiLineString>(\n geojson: Feature<T> | FeatureCollection<T> | T\n): FeatureCollection<LineString>;\n\nfunction flatten<T extends Polygon | MultiPolygon>(\n geojson: Feature<T> | FeatureCollection<T> | T\n): FeatureCollection<Polygon>;\n\nfunction flatten(geojson: AllGeoJSON): FeatureCollection<any>;\n\nfunction flatten(geojson: AllGeoJSON): FeatureCollection {\n if (!geojson) throw new Error(\"geojson is required\");\n\n var results: Feature[] = [];\n flattenEach(geojson, function (feature) {\n results.push(feature);\n });\n return featureCollection(results);\n}\n\nexport { flatten };\nexport default flatten;\n"],"mappings":";AAAA,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AA6ClC,SAAS,QAAQ,SAAwC;AACvD,MAAI,CAAC,QAAS,OAAM,IAAI,MAAM,qBAAqB;AAEnD,MAAI,UAAqB,CAAC;AAC1B,cAAY,SAAS,SAAU,SAAS;AACtC,YAAQ,KAAK,OAAO;AAAA,EACtB,CAAC;AACD,SAAO,kBAAkB,OAAO;AAClC;AAGA,IAAO,uBAAQ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/flatten",
3
- "version": "7.1.0",
3
+ "version": "7.2.0",
4
4
  "description": "turf flatten module",
5
5
  "author": "Turf Authors",
6
6
  "contributors": [
@@ -58,21 +58,21 @@
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/benchmark": "^2.1.5",
61
- "@types/tape": "^4.2.32",
61
+ "@types/tape": "^4.13.4",
62
62
  "benchmark": "^2.1.4",
63
63
  "load-json-file": "^7.0.1",
64
64
  "npm-run-all": "^4.1.5",
65
- "tape": "^5.7.2",
66
- "tsup": "^8.0.1",
67
- "tsx": "^4.6.2",
68
- "typescript": "^5.2.2",
65
+ "tape": "^5.9.0",
66
+ "tsup": "^8.3.5",
67
+ "tsx": "^4.19.2",
68
+ "typescript": "^5.5.4",
69
69
  "write-json-file": "^5.0.0"
70
70
  },
71
71
  "dependencies": {
72
- "@turf/helpers": "^7.1.0",
73
- "@turf/meta": "^7.1.0",
72
+ "@turf/helpers": "^7.2.0",
73
+ "@turf/meta": "^7.2.0",
74
74
  "@types/geojson": "^7946.0.10",
75
- "tslib": "^2.6.2"
75
+ "tslib": "^2.8.1"
76
76
  },
77
- "gitHead": "68915eeebc9278bb40dec3f1034499698a0561ef"
77
+ "gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867"
78
78
  }