@turf/hex-grid
Advanced tools
Comparing version 5.1.0 to 5.1.5
22
main.js
@@ -38,3 +38,3 @@ 'use strict'; | ||
options = options || {}; | ||
if (!helpers.isObject(options)) { throw new Error('options is invalid'); } | ||
if (!helpers.isObject(options)) throw new Error('options is invalid'); | ||
// var units = options.units; | ||
@@ -46,8 +46,8 @@ var properties = options.properties || {}; | ||
// validation | ||
if (cellSide === null || cellSide === undefined) { throw new Error('cellSide is required'); } | ||
if (!helpers.isNumber(cellSide)) { throw new Error('cellSide is invalid'); } | ||
if (!bbox) { throw new Error('bbox is required'); } | ||
if (!Array.isArray(bbox)) { throw new Error('bbox must be array'); } | ||
if (bbox.length !== 4) { throw new Error('bbox must contain 4 numbers'); } | ||
if (mask && ['Polygon', 'MultiPolygon'].indexOf(invariant.getType(mask)) === -1) { throw new Error('options.mask must be a (Multi)Polygon'); } | ||
if (cellSide === null || cellSide === undefined) throw new Error('cellSide is required'); | ||
if (!helpers.isNumber(cellSide)) throw new Error('cellSide is invalid'); | ||
if (!bbox) throw new Error('bbox is required'); | ||
if (!Array.isArray(bbox)) throw new Error('bbox must be array'); | ||
if (bbox.length !== 4) throw new Error('bbox must contain 4 numbers'); | ||
if (mask && ['Polygon', 'MultiPolygon'].indexOf(invariant.getType(mask)) === -1) throw new Error('options.mask must be a (Multi)Polygon'); | ||
@@ -107,4 +107,4 @@ var west = bbox[0]; | ||
var isOdd = x % 2 === 1; | ||
if (y === 0 && isOdd) { continue; } | ||
if (y === 0 && hasOffsetY) { continue; } | ||
if (y === 0 && isOdd) continue; | ||
if (y === 0 && hasOffsetY) continue; | ||
@@ -127,3 +127,3 @@ var center_x = x * x_interval + west - x_adjust; | ||
if (mask) { | ||
if (intersect(mask, triangle)) { results.push(triangle); } | ||
if (intersect(mask, triangle)) results.push(triangle); | ||
} else { | ||
@@ -143,3 +143,3 @@ results.push(triangle); | ||
if (mask) { | ||
if (intersect(mask, hex)) { results.push(hex); } | ||
if (intersect(mask, hex)) results.push(hex); | ||
} else { | ||
@@ -146,0 +146,0 @@ results.push(hex); |
{ | ||
"name": "@turf/hex-grid", | ||
"version": "5.1.0", | ||
"version": "5.1.5", | ||
"description": "turf hex-grid module", | ||
"main": "main.js", | ||
"module": "main.mjs", | ||
"module": "main.es.js", | ||
"types": "index.d.ts", | ||
@@ -12,3 +12,3 @@ "files": [ | ||
"main.js", | ||
"main.mjs" | ||
"main.es.js" | ||
], | ||
@@ -18,2 +18,3 @@ "scripts": { | ||
"test": "node -r @std/esm test.js", | ||
"posttest": "node -r @std/esm ../../scripts/validate-es5-dependencies.js", | ||
"bench": "node -r @std/esm bench.js", | ||
@@ -50,8 +51,7 @@ "docs": "node ../../scripts/generate-readmes" | ||
"@std/esm": "*", | ||
"@turf/bbox-polygon": "^5.1.0", | ||
"@turf/truncate": "^5.1.0", | ||
"@turf/bbox-polygon": "^5.1.5", | ||
"@turf/truncate": "^5.1.5", | ||
"benchmark": "*", | ||
"load-json-file": "*", | ||
"rollup": "*", | ||
"rollup-plugin-buble": "*", | ||
"tape": "*", | ||
@@ -61,6 +61,6 @@ "write-json-file": "*" | ||
"dependencies": { | ||
"@turf/distance": "^5.1.0", | ||
"@turf/helpers": "^5.1.0", | ||
"@turf/intersect": "^5.1.0", | ||
"@turf/invariant": "^5.1.0" | ||
"@turf/distance": "^5.1.5", | ||
"@turf/helpers": "^5.1.5", | ||
"@turf/intersect": "^5.1.5", | ||
"@turf/invariant": "^5.1.5" | ||
}, | ||
@@ -67,0 +67,0 @@ "@std/esm": { |
27915
8
Updated@turf/distance@^5.1.5
Updated@turf/helpers@^5.1.5
Updated@turf/intersect@^5.1.5
Updated@turf/invariant@^5.1.5