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

@turf/boolean-disjoint

Package Overview
Dependencies
Maintainers
9
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/boolean-disjoint - npm Package Compare versions

Comparing version 7.1.0-alpha.7 to 7.1.0-alpha.70

8

dist/esm/index.d.ts

@@ -9,3 +9,5 @@ import { Feature, Geometry } from 'geojson';

* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
* @returns {boolean} true/false
* @param {Object} [options={}] Optional parameters
* @param {boolean} [options.ignoreSelfIntersections=false] ignores self-intersections on input features
* @returns {boolean} true if the intersection is an empty set, false otherwise
* @example

@@ -18,4 +20,6 @@ * var point = turf.point([2, 2]);

*/
declare function booleanDisjoint(feature1: Feature<any> | Geometry, feature2: Feature<any> | Geometry): boolean;
declare function booleanDisjoint(feature1: Feature<any> | Geometry, feature2: Feature<any> | Geometry, options?: {
ignoreSelfIntersections?: boolean;
}): boolean;
export { booleanDisjoint, booleanDisjoint as default };

@@ -6,3 +6,5 @@ // index.ts

import { polygonToLine } from "@turf/polygon-to-line";
function booleanDisjoint(feature1, feature2) {
function booleanDisjoint(feature1, feature2, options = {}) {
var _a;
const ignoreSelfIntersections = (_a = options.ignoreSelfIntersections) != null ? _a : false;
let bool = true;

@@ -14,3 +16,7 @@ flattenEach(feature1, (flatten1) => {

}
bool = disjoint(flatten1.geometry, flatten2.geometry);
bool = disjoint(
flatten1.geometry,
flatten2.geometry,
ignoreSelfIntersections
);
});

@@ -20,3 +26,3 @@ });

}
function disjoint(geom1, geom2) {
function disjoint(geom1, geom2, ignoreSelfIntersections) {
switch (geom1.type) {

@@ -38,5 +44,5 @@ case "Point":

case "LineString":
return !isLineOnLine(geom1, geom2);
return !isLineOnLine(geom1, geom2, ignoreSelfIntersections);
case "Polygon":
return !isLineInPoly(geom2, geom1);
return !isLineInPoly(geom2, geom1, ignoreSelfIntersections);
}

@@ -49,5 +55,5 @@ break;

case "LineString":
return !isLineInPoly(geom1, geom2);
return !isLineInPoly(geom1, geom2, ignoreSelfIntersections);
case "Polygon":
return !isPolyInPoly(geom2, geom1);
return !isPolyInPoly(geom2, geom1, ignoreSelfIntersections);
}

@@ -69,4 +75,6 @@ }

}
function isLineOnLine(lineString1, lineString2) {
const doLinesIntersect = lineIntersect(lineString1, lineString2);
function isLineOnLine(lineString1, lineString2, ignoreSelfIntersections) {
const doLinesIntersect = lineIntersect(lineString1, lineString2, {
ignoreSelfIntersections
});
if (doLinesIntersect.features.length > 0) {

@@ -77,3 +85,3 @@ return true;

}
function isLineInPoly(polygon, lineString) {
function isLineInPoly(polygon, lineString, ignoreSelfIntersections) {
for (const coord of lineString.coordinates) {

@@ -84,3 +92,5 @@ if (booleanPointInPolygon(coord, polygon)) {

}
const doLinesIntersect = lineIntersect(lineString, polygonToLine(polygon));
const doLinesIntersect = lineIntersect(lineString, polygonToLine(polygon), {
ignoreSelfIntersections
});
if (doLinesIntersect.features.length > 0) {

@@ -91,3 +101,3 @@ return true;

}
function isPolyInPoly(feature1, feature2) {
function isPolyInPoly(feature1, feature2, ignoreSelfIntersections) {
for (const coord1 of feature1.coordinates[0]) {

@@ -105,3 +115,4 @@ if (booleanPointInPolygon(coord1, feature2)) {

polygonToLine(feature1),
polygonToLine(feature2)
polygonToLine(feature2),
{ ignoreSelfIntersections }
);

@@ -108,0 +119,0 @@ if (doLinesIntersect.features.length > 0) {

{
"name": "@turf/boolean-disjoint",
"version": "7.1.0-alpha.7+0ce6ecca0",
"version": "7.1.0-alpha.70+948cdafaf",
"description": "turf boolean-disjoint module",

@@ -70,10 +70,11 @@ "author": "Turf Authors",

"dependencies": {
"@turf/boolean-point-in-polygon": "^7.1.0-alpha.7+0ce6ecca0",
"@turf/helpers": "^7.1.0-alpha.7+0ce6ecca0",
"@turf/line-intersect": "^7.1.0-alpha.7+0ce6ecca0",
"@turf/meta": "^7.1.0-alpha.7+0ce6ecca0",
"@turf/polygon-to-line": "^7.1.0-alpha.7+0ce6ecca0",
"@turf/boolean-point-in-polygon": "^7.1.0-alpha.70+948cdafaf",
"@turf/helpers": "^7.1.0-alpha.70+948cdafaf",
"@turf/line-intersect": "^7.1.0-alpha.70+948cdafaf",
"@turf/meta": "^7.1.0-alpha.70+948cdafaf",
"@turf/polygon-to-line": "^7.1.0-alpha.70+948cdafaf",
"@types/geojson": "^7946.0.10",
"tslib": "^2.6.2"
},
"gitHead": "0ce6ecca05829690270fec6d6bed2003495fe0ea"
"gitHead": "948cdafaf70606d2e27fcc79973fa48ee1182067"
}

@@ -13,3 +13,6 @@ # @turf/boolean-disjoint

* `feature2` **([Geometry][1] | [Feature][2]\<any>)** GeoJSON Feature or Geometry
* `options` **[Object][3]** Optional parameters (optional, default `{}`)
* `options.ignoreSelfIntersections` **[boolean][4]** ignores self-intersections on input features (optional, default `false`)
### Examples

@@ -25,3 +28,3 @@

Returns **[boolean][3]** true/false
Returns **[boolean][4]** true if the intersection is an empty set, false otherwise

@@ -32,4 +35,6 @@ [1]: https://tools.ietf.org/html/rfc7946#section-3.1

[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
<!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run "yarn docs" from the root of the turf project. -->

@@ -36,0 +41,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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