@turf/flatten
Advanced tools
Comparing version 4.7.3 to 5.0.4
@@ -1,22 +0,21 @@ | ||
/// <reference types="geojson" /> | ||
import { | ||
Point, Points, MultiPoint, MultiPoints, | ||
LineString, LineStrings, MultiLineString, MultiLineStrings, | ||
Polygon, Polygons, MultiPolygon, MultiPolygons, | ||
Feature, Features} from '@turf/helpers' | ||
Point, | ||
MultiPoint, | ||
LineString, | ||
MultiLineString, | ||
Polygon, | ||
MultiPolygon, | ||
Feature, | ||
FeatureCollection, | ||
AllGeoJSON | ||
} from '@turf/helpers' | ||
interface Flatten { | ||
/** | ||
* http://turfjs.org/docs/#flatten | ||
*/ | ||
(geojson: Point | Points | MultiPoint | MultiPoints): Points; | ||
(geojson: LineString | LineStrings | MultiLineString | MultiLineStrings): LineStrings; | ||
(geojson: Polygons | Polygons | MultiPolygons | MultiPolygons): Polygons; | ||
(geojson: Feature<any> | Features<any>): Features<any>; | ||
(geojson: GeoJSON.GeometryCollection | GeoJSON.GeometryObject): Features<any>; | ||
} | ||
/** | ||
* http://turfjs.org/docs/#flatten | ||
*/ | ||
declare function flatten<T extends Point | MultiPoint>(geojson: Feature<T> | FeatureCollection<T> | T): FeatureCollection<Point>; | ||
declare function flatten<T extends LineString | MultiLineString>(geojson: Feature<T> | FeatureCollection<T> | T): FeatureCollection<LineString>; | ||
declare function flatten<T extends Polygon | MultiPolygon>(geojson: Feature<T> | FeatureCollection<T> | T): FeatureCollection<Polygon>; | ||
declare function flatten(geojson: AllGeoJSON): FeatureCollection<any>; | ||
declare const flatten: Flatten; | ||
declare namespace flatten { } | ||
export = flatten; | ||
export default flatten; |
12
index.js
@@ -1,3 +0,3 @@ | ||
var flattenEach = require('@turf/meta').flattenEach; | ||
var featureCollection = require('@turf/helpers').featureCollection; | ||
import { flattenEach } from '@turf/meta'; | ||
import { featureCollection } from '@turf/helpers'; | ||
@@ -8,3 +8,3 @@ /** | ||
* @name flatten | ||
* @param {FeatureCollection|Geometry|Feature<any>} geojson any valid GeoJSON Object | ||
* @param {GeoJSON} geojson any valid GeoJSON Object | ||
* @returns {FeatureCollection<any>} all Multi-Geometries are flattened into single Features | ||
@@ -23,3 +23,3 @@ * @example | ||
*/ | ||
module.exports = function (geojson) { | ||
function flatten(geojson) { | ||
if (!geojson) throw new Error('geojson is required'); | ||
@@ -32,2 +32,4 @@ | ||
return featureCollection(results); | ||
}; | ||
} | ||
export default flatten; |
{ | ||
"name": "@turf/flatten", | ||
"version": "4.7.3", | ||
"version": "5.0.4", | ||
"description": "turf flatten module", | ||
"main": "index.js", | ||
"main": "main", | ||
"module": "index", | ||
"jsnext:main": "index", | ||
"types": "index.d.ts", | ||
"files": [ | ||
"index.js", | ||
"index.d.ts" | ||
"index.d.ts", | ||
"main.js" | ||
], | ||
"scripts": { | ||
"test": "node test.js", | ||
"bench": "node bench.js" | ||
"pretest": "rollup -c ../../rollup.config.js", | ||
"test": "node -r @std/esm test.js", | ||
"bench": "node -r @std/esm bench.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/Turfjs/turf.git" | ||
"url": "git://github.com/Turfjs/turf.git" | ||
}, | ||
@@ -37,11 +41,17 @@ "keywords": [ | ||
"devDependencies": { | ||
"benchmark": "^2.1.4", | ||
"load-json-file": "^2.0.0", | ||
"tape": "^4.6.3", | ||
"write-json-file": "^2.0.0" | ||
"@std/esm": "*", | ||
"benchmark": "*", | ||
"load-json-file": "*", | ||
"rollup": "*", | ||
"tape": "*", | ||
"write-json-file": "*" | ||
}, | ||
"dependencies": { | ||
"@turf/helpers": "^4.7.3", | ||
"@turf/meta": "^4.7.3" | ||
"@turf/helpers": "^5.0.4", | ||
"@turf/meta": "^5.0.4" | ||
}, | ||
"@std/esm": { | ||
"esm": "js", | ||
"cjs": true | ||
} | ||
} |
# @turf/flatten | ||
# flatten | ||
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
## flatten | ||
Flattens any [GeoJSON](http://geojson.org/geojson-spec.html#geojson-objects) to a [FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) inspired by [geojson-flatten](https://github.com/tmcw/geojson-flatten). | ||
@@ -9,3 +11,3 @@ | ||
- `geojson` **([FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) \| [Geometry](http://geojson.org/geojson-spec.html#geometry) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects)<any>)** any valid GeoJSON Object | ||
- `geojson` **[GeoJSON](http://geojson.org/geojson-spec.html#geojson-objects)** any valid GeoJSON Object | ||
@@ -12,0 +14,0 @@ **Examples** |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6775
6
79
54
6
+ Added@turf/helpers@5.1.5(transitive)
+ Added@turf/meta@5.2.0(transitive)
- Removed@turf/helpers@4.7.3(transitive)
- Removed@turf/meta@4.7.4(transitive)
Updated@turf/helpers@^5.0.4
Updated@turf/meta@^5.0.4