@turf/difference
Advanced tools
Comparing version 4.7.3 to 4.7.4
@@ -6,3 +6,3 @@ /// <reference types="geojson" /> | ||
type Input = Feature<Polygon|MultiPolygon> | Polygon | MultiPolygon; | ||
type Output = Feature<Polygon|MultiPolygon> | undefined; | ||
type Output = Feature<Polygon|MultiPolygon> | null; | ||
@@ -9,0 +9,0 @@ /** |
10
index.js
@@ -14,3 +14,3 @@ // depend on jsts for now https://github.com/bjornharrtell/jsts/blob/master/examples/overlay.html | ||
* @param {Feature<Polygon|MultiPolygon>} polygon2 Polygon feature to difference from polygon1 | ||
* @returns {Feature<Polygon|MultiPolygon>|undefined} a Polygon or MultiPolygon feature showing the area of `polygon1` excluding the area of `polygon2` (if empty returns `undefined`) | ||
* @returns {Feature<Polygon|MultiPolygon>|null} a Polygon or MultiPolygon feature showing the area of `polygon1` excluding the area of `polygon2` (if empty returns `null`) | ||
* @example | ||
@@ -51,3 +51,3 @@ * var polygon1 = turf.polygon([[ | ||
geom2 = removeEmptyPolygon(geom2); | ||
if (!geom1) return undefined; | ||
if (!geom1) return null; | ||
if (!geom2) return feature(geom1, properties); | ||
@@ -60,3 +60,3 @@ | ||
var differenced = a.difference(b); | ||
if (differenced.isEmpty()) return undefined; | ||
if (differenced.isEmpty()) return null; | ||
var writer = new jsts.io.GeoJSONWriter(); | ||
@@ -73,3 +73,3 @@ var geom = writer.write(differenced); | ||
* @param {Geometry<Polygon|MultiPolygon>} geom Geometry Object | ||
* @returns {Geometry<Polygon|MultiPolygon>|undefined} removed any polygons with no areas | ||
* @returns {Geometry<Polygon|MultiPolygon>|null} removed any polygons with no areas | ||
*/ | ||
@@ -80,3 +80,3 @@ function removeEmptyPolygon(geom) { | ||
if (area(geom) > 1) return geom; | ||
return undefined; | ||
return null; | ||
case 'MultiPolygon': | ||
@@ -83,0 +83,0 @@ var coordinates = []; |
{ | ||
"name": "@turf/difference", | ||
"version": "4.7.3", | ||
"version": "4.7.4", | ||
"description": "turf difference module", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -42,3 +42,3 @@ # @turf/difference | ||
Returns **([Feature](http://geojson.org/geojson-spec.html#feature-objects)<([Polygon](http://geojson.org/geojson-spec.html#polygon) \| [MultiPolygon](http://geojson.org/geojson-spec.html#multipolygon))> | [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined))** a Polygon or MultiPolygon feature showing the area of `polygon1` excluding the area of `polygon2` (if empty returns `undefined`) | ||
Returns **([Feature](http://geojson.org/geojson-spec.html#feature-objects)<([Polygon](http://geojson.org/geojson-spec.html#polygon) \| [MultiPolygon](http://geojson.org/geojson-spec.html#multipolygon))> | [null](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null))** a Polygon or MultiPolygon feature showing the area of `polygon1` excluding the area of `polygon2` (if empty returns `null`) | ||
@@ -45,0 +45,0 @@ <!-- This file is automatically generated. Please don't edit it directly: |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7230