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

@turf/boolean-disjoint

Package Overview
Dependencies
Maintainers
4
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 4.7.3 to 5.0.4

main.js

13

index.d.ts

@@ -1,10 +0,9 @@

/// <reference types="geojson" />
import { Feature, GeometryObject } from '@turf/helpers'
type Feature = GeoJSON.Feature<any> | GeoJSON.GeometryObject;
/**
* http://turfjs.org/docs/#boolean-disjoint
* http://turfjs.org/docs/#booleandisjoint
*/
declare function booleanDisjoint(feature1: Feature, feature2: Feature): boolean;
declare namespace booleanDisjoint { }
export = booleanDisjoint;
export default function (
feature1: Feature<any> | GeometryObject,
feature2: Feature<any> | GeometryObject
): boolean;

@@ -1,5 +0,5 @@

var inside = require('@turf/inside');
var flattenEach = require('@turf/meta').flattenEach;
var lineIntersect = require('@turf/line-intersect');
var polyToLinestring = require('@turf/polygon-to-linestring');
import booleanPointInPolygon from '@turf/boolean-point-in-polygon';
import { flattenEach } from '@turf/meta';
import lineIntersect from '@turf/line-intersect';
import polygonToLine from '@turf/polygon-to-line';

@@ -12,6 +12,6 @@ /**

* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
* @returns {Boolean} true/false
* @returns {boolean} true/false
* @example
* const point = turf.point([2, 2]);
* const line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);
* var point = turf.point([2, 2]);
* var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);
*

@@ -21,3 +21,3 @@ * turf.booleanDisjoint(line, point);

*/
module.exports = function (feature1, feature2) {
function booleanDisjoint(feature1, feature2) {
var boolean;

@@ -31,3 +31,3 @@ flattenEach(feature1, function (flatten1) {

return boolean;
};
}

@@ -40,3 +40,3 @@ /**

* @param {Geometry<any>} geom2 GeoJSON Geometry
* @returns {Boolean} true/false
* @returns {boolean} true/false
*/

@@ -52,3 +52,3 @@ function disjoint(geom1, geom2) {

case 'Polygon':
return !inside(geom1, geom2);
return !booleanPointInPolygon(geom1, geom2);
}

@@ -71,3 +71,3 @@ /* istanbul ignore next */

case 'Point':
return !inside(geom2, geom1);
return !booleanPointInPolygon(geom2, geom1);
case 'LineString':

@@ -100,3 +100,3 @@ return !isLineInPoly(geom1, geom2);

function isLineInPoly(polygon, lineString) {
var doLinesIntersect = lineIntersect(lineString, polyToLinestring(polygon));
var doLinesIntersect = lineIntersect(lineString, polygonToLine(polygon));
if (doLinesIntersect.features.length > 0) {

@@ -116,7 +116,7 @@ return true;

* @param {Geometry|Feature<Polygon>} feature2 Polygon2
* @returns {Boolean} true/false
* @returns {boolean} true/false
*/
function isPolyInPoly(feature1, feature2) {
for (var i = 0; i < feature1.coordinates[0].length; i++) {
if (inside(feature1.coordinates[0][i], feature2)) {
if (booleanPointInPolygon(feature1.coordinates[0][i], feature2)) {
return true;

@@ -126,3 +126,3 @@ }

for (var i2 = 0; i2 < feature2.coordinates[0].length; i2++) {
if (inside(feature2.coordinates[0][i2], feature1)) {
if (booleanPointInPolygon(feature2.coordinates[0][i2], feature1)) {
return true;

@@ -160,4 +160,4 @@ }

* @private
* @param {[number, number]} pair1 point [x,y]
* @param {[number, number]} pair2 point [x,y]
* @param {Array<number>} pair1 point [x,y]
* @param {Array<number>} pair2 point [x,y]
* @returns {boolean} true/false if coord pairs match

@@ -168,1 +168,3 @@ */

}
export default booleanDisjoint;
{
"name": "@turf/boolean-disjoint",
"version": "4.7.3",
"version": "5.0.4",
"description": "turf boolean-disjoint 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"
},

@@ -36,14 +40,20 @@ "repository": {

"devDependencies": {
"@turf/helpers": "^4.7.3",
"benchmark": "2.1.4",
"boolean-shapely": "0.1.2",
"load-json-file": "2.0.0",
"tape": "4.7.0"
"@std/esm": "*",
"@turf/helpers": "^5.0.4",
"benchmark": "*",
"boolean-shapely": "*",
"load-json-file": "*",
"rollup": "*",
"tape": "*"
},
"dependencies": {
"@turf/inside": "^4.7.3",
"@turf/line-intersect": "^4.7.3",
"@turf/meta": "^4.7.3",
"@turf/polygon-to-linestring": "^4.7.3"
"@turf/boolean-point-in-polygon": "^5.0.4",
"@turf/line-intersect": "^5.0.4",
"@turf/meta": "^5.0.4",
"@turf/polygon-to-line": "^5.0.4"
},
"@std/esm": {
"esm": "js",
"cjs": true
}
}
# @turf/boolean-disjoint
# booleanDisjoint
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
## booleanDisjoint
Boolean-disjoint returns (TRUE) if the intersection of the two geometries is an empty set.

@@ -15,4 +17,4 @@

```javascript
const point = turf.point([2, 2]);
const line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);
var point = turf.point([2, 2]);
var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);

@@ -23,3 +25,3 @@ turf.booleanDisjoint(line, point);

Returns **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true/false
Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true/false

@@ -26,0 +28,0 @@ <!-- This file is automatically generated. Please don't edit it directly:

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