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

@turf/intersect

Package Overview
Dependencies
Maintainers
4
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/intersect - npm Package Compare versions

Comparing version 4.6.0 to 4.7.0

22

index.js
// depend on jsts for now http://bjornharrtell.github.io/jsts/
var jsts = require('jsts');
var truncate = require('@turf/truncate');

@@ -37,18 +38,17 @@ /**

module.exports = function (poly1, poly2) {
var geom1, geom2;
if (poly1.type === 'Feature') geom1 = poly1.geometry;
else geom1 = poly1;
if (poly2.type === 'Feature') geom2 = poly2.geometry;
else geom2 = poly2;
var geom1 = (poly1.type === 'Feature') ? poly1.geometry : poly1;
var geom2 = (poly2.type === 'Feature') ? poly2.geometry : poly2;
var reader = new jsts.io.GeoJSONReader();
var a = reader.read(JSON.stringify(geom1));
var b = reader.read(JSON.stringify(geom2));
var a = reader.read(truncate(geom1));
var b = reader.read(truncate(geom2));
var intersection = a.intersection(b);
if (intersection.isEmpty()) {
return undefined;
}
if (intersection.isEmpty()) return {
type: 'Feature',
properties: {},
geometry: null
};
var writer = new jsts.io.GeoJSONWriter();
var geojsonGeometry = writer.write(intersection);

@@ -55,0 +55,0 @@ return {

{
"name": "@turf/intersect",
"version": "4.6.0",
"version": "4.7.0",
"description": "turf intersect module",

@@ -37,4 +37,5 @@ "main": "index.js",

"dependencies": {
"@turf/truncate": "4.7.0",
"jsts": "1.3.0"
}
}
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