Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@turf/flatten

Package Overview
Dependencies
Maintainers
4
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/flatten - npm Package Compare versions

Comparing version 4.7.3 to 5.0.4

main.js

37

index.d.ts

@@ -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;

@@ -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)&lt;any>)** any valid GeoJSON Object
- `geojson` **[GeoJSON](http://geojson.org/geojson-spec.html#geojson-objects)** any valid GeoJSON Object

@@ -12,0 +14,0 @@ **Examples**

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc