diff --git a/packages/turf-boolean-intersects/index.ts b/packages/turf-boolean-intersects/index.ts index 50b08925f..b411ed5c2 100644 --- a/packages/turf-boolean-intersects/index.ts +++ b/packages/turf-boolean-intersects/index.ts @@ -1,6 +1,5 @@ import { Feature, Geometry } from "geojson"; import { booleanDisjoint } from "@turf/boolean-disjoint"; -import { flattenEach } from "@turf/meta"; /** * Boolean-intersects returns (TRUE) if the intersection of the two geometries is NOT an empty set. @@ -36,18 +35,9 @@ function booleanIntersects( ignoreSelfIntersections?: boolean; } = {} ) { - let bool = false; - flattenEach(feature1, (flatten1) => { - flattenEach(feature2, (flatten2) => { - if (bool === true) { - return true; - } - bool = !booleanDisjoint(flatten1.geometry, flatten2.geometry, { - ignoreSelfIntersections, - }); - }); - }); - return bool; + // booleanDisjoint already compares every flattened geometry pair, so + // intersects is simply its negation. + return !booleanDisjoint(feature1, feature2, { ignoreSelfIntersections }); } export { booleanIntersects }; diff --git a/packages/turf-boolean-intersects/package.json b/packages/turf-boolean-intersects/package.json index c6cad7b88..e147d5fcc 100644 --- a/packages/turf-boolean-intersects/package.json +++ b/packages/turf-boolean-intersects/package.json @@ -6,7 +6,8 @@ "contributors": [ "Rowan Winsemius <@rowanwins>", "Denis Carriere <@DenisCarriere>", - "David Whittingham <@01100100>" + "David Whittingham <@01100100>", + "Espen Hovlandsdal <@rexxars>" ], "license": "MIT", "bugs": { @@ -67,8 +68,6 @@ }, "dependencies": { "@turf/boolean-disjoint": "workspace:*", - "@turf/helpers": "workspace:*", - "@turf/meta": "workspace:*", "@types/geojson": "catalog:", "tslib": "catalog:" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5b16f38d7..1b0ab5f4b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1193,12 +1193,6 @@ importers: '@turf/boolean-disjoint': specifier: workspace:* version: link:../turf-boolean-disjoint - '@turf/helpers': - specifier: workspace:* - version: link:../turf-helpers - '@turf/meta': - specifier: workspace:* - version: link:../turf-meta '@types/geojson': specifier: 'catalog:' version: 7946.0.14