@turf/buffer
Advanced tools
Comparing version 5.1.0 to 5.1.1
24
main.js
@@ -43,9 +43,9 @@ 'use strict'; | ||
// validation | ||
if (!geojson) { throw new Error('geojson is required'); } | ||
if (typeof options !== 'object') { throw new Error('options must be an object'); } | ||
if (typeof steps !== 'number') { throw new Error('steps must be an number'); } | ||
if (!geojson) throw new Error('geojson is required'); | ||
if (typeof options !== 'object') throw new Error('options must be an object'); | ||
if (typeof steps !== 'number') throw new Error('steps must be an number'); | ||
// Allow negative buffers ("erosion") or zero-sized buffers ("repair geometry") | ||
if (radius === undefined) { throw new Error('radius is required'); } | ||
if (steps <= 0) { throw new Error('steps must be greater than 0'); } | ||
if (radius === undefined) throw new Error('radius is required'); | ||
if (steps <= 0) throw new Error('steps must be greater than 0'); | ||
@@ -61,3 +61,3 @@ // default params | ||
var buffered = bufferFeature(geometry, radius, units, steps); | ||
if (buffered) { results.push(buffered); } | ||
if (buffered) results.push(buffered); | ||
}); | ||
@@ -70,3 +70,3 @@ return helpers.featureCollection(results); | ||
meta.featureEach(multiBuffered, function (buffered) { | ||
if (buffered) { results.push(buffered); } | ||
if (buffered) results.push(buffered); | ||
}); | ||
@@ -99,3 +99,3 @@ } | ||
var buffered = bufferFeature(geometry, radius, units, steps); | ||
if (buffered) { results.push(buffered); } | ||
if (buffered) results.push(buffered); | ||
}); | ||
@@ -128,3 +128,3 @@ return helpers.featureCollection(results); | ||
// Detect if empty geometries | ||
if (coordsIsNaN(buffered.coordinates)) { return undefined; } | ||
if (coordsIsNaN(buffered.coordinates)) return undefined; | ||
@@ -153,3 +153,3 @@ // Unproject coordinates (convert to Degrees) | ||
function coordsIsNaN(coords) { | ||
if (Array.isArray(coords[0])) { return coordsIsNaN(coords[0]); } | ||
if (Array.isArray(coords[0])) return coordsIsNaN(coords[0]); | ||
return isNaN(coords[0]); | ||
@@ -167,3 +167,3 @@ } | ||
function projectCoords(coords, proj) { | ||
if (typeof coords[0] !== 'object') { return proj(coords); } | ||
if (typeof coords[0] !== 'object') return proj(coords); | ||
return coords.map(function (coord) { | ||
@@ -183,3 +183,3 @@ return projectCoords(coord, proj); | ||
function unprojectCoords(coords, proj) { | ||
if (typeof coords[0] !== 'object') { return proj.invert(coords); } | ||
if (typeof coords[0] !== 'object') return proj.invert(coords); | ||
return coords.map(function (coord) { | ||
@@ -186,0 +186,0 @@ return unprojectCoords(coord, proj); |
{ | ||
"name": "@turf/buffer", | ||
"version": "5.1.0", | ||
"version": "5.1.1", | ||
"description": "turf buffer module", | ||
@@ -46,9 +46,11 @@ "main": "main.js", | ||
"@std/esm": "*", | ||
"@turf/truncate": "^5.1.0", | ||
"@turf/truncate": "*", | ||
"benchmark": "*", | ||
"load-json-file": "*", | ||
"rollup": "*", | ||
"rollup-plugin-buble": "*", | ||
"tape": "*", | ||
"write-json-file": "*" | ||
"write-json-file": "*", | ||
"rollup-plugin-node-resolve": "*", | ||
"rollup-plugin-uglify": "*", | ||
"rollup-plugin-commonjs": "*" | ||
}, | ||
@@ -55,0 +57,0 @@ "dependencies": { |
26964
10