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

@turf/combine

Package Overview
Dependencies
Maintainers
4
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/combine - npm Package Compare versions

Comparing version 4.7.3 to 5.0.4

main.js

38

index.d.ts

@@ -1,22 +0,20 @@

/// <reference types="geojson" />
import {
Point,
LineString,
Polygon,
MultiPoint,
MultiLineString,
MultiPolygon,
Feature,
FeatureCollection
} from '@turf/helpers'
type Points = GeoJSON.FeatureCollection<GeoJSON.Point>;
type LineStrings = GeoJSON.FeatureCollection<GeoJSON.LineString>;
type Polygons = GeoJSON.FeatureCollection<GeoJSON.Polygon>;
type MultiPoints = GeoJSON.FeatureCollection<GeoJSON.MultiPoint>;
type MultiLineStrings = GeoJSON.FeatureCollection<GeoJSON.MultiLineString>;
type MultiPolygons = GeoJSON.FeatureCollection<GeoJSON.MultiPolygon>;
type Features = GeoJSON.FeatureCollection<any>;
/**
* http://turfjs.org/docs/#combine
*/
declare function combine(features: FeatureCollection<Point>): MultiPoint;
declare function combine(features: FeatureCollection<LineString>): MultiLineString;
declare function combine(features: FeatureCollection<Polygon>): MultiPolygon;
declare function combine(features: FeatureCollection<any>): Feature<any>;
interface CombineStatic {
/**
* http://turfjs.org/docs/#combine
*/
(features: Points): MultiPoints;
(features: LineStrings): MultiLineStrings;
(features: Polygons): MultiPolygons;
(features: Features): Features;
}
declare const combine: CombineStatic;
declare namespace combine { }
export = combine;
export default combine;

@@ -1,2 +0,3 @@

var meta = require('@turf/meta');
import { feature, featureCollection } from '@turf/helpers';
import { featureEach } from '@turf/meta';

@@ -21,3 +22,3 @@ /**

*/
module.exports = function (fc) {
function combine(fc) {
var groups = {

@@ -43,3 +44,3 @@ MultiPoint: {coordinates: [], properties: []},

meta.featureEach(fc, function (feature) {
featureEach(fc, function (feature) {
if (!feature.geometry) return;

@@ -53,22 +54,14 @@ if (groups[feature.geometry.type]) {

return {
type: 'FeatureCollection',
features: Object.keys(groups)
.filter(function (key) {
return groups[key].coordinates.length;
})
.sort()
.map(function (key) {
return {
type: 'Feature',
properties: {
collectedProperties: groups[key].properties
},
geometry: {
type: key,
coordinates: groups[key].coordinates
}
};
})
};
};
return featureCollection(Object.keys(groups)
.filter(function (key) {
return groups[key].coordinates.length;
})
.sort()
.map(function (key) {
var geometry = { type: key, coordinates: groups[key].coordinates };
var properties = { collectedProperties: groups[key].properties };
return feature(geometry, properties);
}));
}
export default combine;
{
"name": "@turf/combine",
"version": "4.7.3",
"version": "5.0.4",
"description": "turf combine 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"
},

@@ -33,9 +37,15 @@ "repository": {

"devDependencies": {
"@turf/helpers": "^4.7.3",
"benchmark": "^2.1.4",
"tape": "^4.6.3"
"@std/esm": "*",
"benchmark": "*",
"rollup": "*",
"tape": "*"
},
"dependencies": {
"@turf/meta": "^4.7.3"
"@turf/helpers": "^5.0.4",
"@turf/meta": "^5.0.4"
},
"@std/esm": {
"esm": "js",
"cjs": true
}
}
# @turf/combine
# combine
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
## combine
Combines a [FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) of [Point](http://geojson.org/geojson-spec.html#point), [LineString](http://geojson.org/geojson-spec.html#linestring), or [Polygon](http://geojson.org/geojson-spec.html#polygon) features

@@ -6,0 +8,0 @@ into [MultiPoint](http://geojson.org/geojson-spec.html#multipoint), [MultiLineString](http://geojson.org/geojson-spec.html#multilinestring), or [MultiPolygon](http://geojson.org/geojson-spec.html#multipolygon) features.

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