@turf/flatten
Advanced tools
Comparing version 6.2.0-alpha.2 to 6.2.0-alpha.3
@@ -23,11 +23,11 @@ import { flattenEach } from '@turf/meta'; | ||
function flatten(geojson) { | ||
if (!geojson) throw new Error('geojson is required'); | ||
if (!geojson) throw new Error("geojson is required"); | ||
var results = []; | ||
flattenEach(geojson, function (feature) { | ||
results.push(feature); | ||
}); | ||
return featureCollection(results); | ||
var results = []; | ||
flattenEach(geojson, function (feature) { | ||
results.push(feature); | ||
}); | ||
return featureCollection(results); | ||
} | ||
export default flatten; |
@@ -25,12 +25,11 @@ 'use strict'; | ||
function flatten(geojson) { | ||
if (!geojson) throw new Error('geojson is required'); | ||
if (!geojson) throw new Error("geojson is required"); | ||
var results = []; | ||
meta.flattenEach(geojson, function (feature) { | ||
results.push(feature); | ||
}); | ||
return helpers.featureCollection(results); | ||
var results = []; | ||
meta.flattenEach(geojson, function (feature) { | ||
results.push(feature); | ||
}); | ||
return helpers.featureCollection(results); | ||
} | ||
module.exports = flatten; | ||
module.exports.default = flatten; |
import { | ||
Point, | ||
MultiPoint, | ||
LineString, | ||
MultiLineString, | ||
Polygon, | ||
MultiPolygon, | ||
Feature, | ||
FeatureCollection, | ||
AllGeoJSON | ||
} from '@turf/helpers' | ||
Point, | ||
MultiPoint, | ||
LineString, | ||
MultiLineString, | ||
Polygon, | ||
MultiPolygon, | ||
Feature, | ||
FeatureCollection, | ||
AllGeoJSON, | ||
} from "@turf/helpers"; | ||
@@ -16,7 +16,13 @@ /** | ||
*/ | ||
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<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>; | ||
export default flatten; |
{ | ||
"name": "@turf/flatten", | ||
"version": "6.2.0-alpha.2", | ||
"version": "6.2.0-alpha.3", | ||
"description": "turf flatten module", | ||
@@ -31,2 +31,6 @@ "author": "Turf Authors", | ||
"module": "dist/es/index.js", | ||
"exports": { | ||
"import": "./dist/es/index.js", | ||
"require": "./dist/js/index.js" | ||
}, | ||
"types": "index.d.ts", | ||
@@ -39,10 +43,9 @@ "sideEffects": false, | ||
"scripts": { | ||
"bench": "npm-run-all prepare bench:run", | ||
"bench:run": "node bench.js", | ||
"bench": "node -r esm bench.js", | ||
"build": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json", | ||
"docs": "node ../../scripts/generate-readmes", | ||
"posttest": "node -r esm ../../scripts/validate-es5-dependencies.js", | ||
"prepare": "rollup -c ../../rollup.config.js", | ||
"test": "npm-run-all prepare test:*", | ||
"test": "npm-run-all test:*", | ||
"test:tape": "node -r esm test.js", | ||
"test:types": "tsc --noEmit types.ts" | ||
"test:types": "tsc --esModuleInterop --noEmit types.ts" | ||
}, | ||
@@ -58,6 +61,6 @@ "devDependencies": { | ||
"dependencies": { | ||
"@turf/helpers": "^6.2.0-alpha.2", | ||
"@turf/meta": "^6.2.0-alpha.2" | ||
"@turf/helpers": "^6.2.0-alpha.3", | ||
"@turf/meta": "^6.2.0-alpha.3" | ||
}, | ||
"gitHead": "23d5cb91d77e0c1e2e903a2252f525797f1d0d09" | ||
"gitHead": "dce9edfc705352e8cb9e0083c9330ba0e8d77409" | ||
} |
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
9313
9
144
Updated@turf/helpers@^6.2.0-alpha.3
Updated@turf/meta@^6.2.0-alpha.3