mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 19:04:02 +00:00
fix(recent-imagery): reject absent box edges instead of inventing zero degrees
This commit is contained in:
1 parent
0265ad4c19
commit
c5ac24b600
4 files changed
+33
-6
No files matched your search
@@ -77,12 +77,17 @@ const pad2 = (value) => String(value).padStart(2, '0');
|
||||
*/
|
||||
function normalizeBox(box) {
|
||||
if (!box || typeof box !== 'object') return null;
|
||||
const [west, south, east, north] = [
|
||||
box.west,
|
||||
box.south,
|
||||
box.east,
|
||||
box.north,
|
||||
].map(Number);
|
||||
const edges = [box.west, box.south, box.east, box.north];
|
||||
if (
|
||||
edges.some(
|
||||
(value) =>
|
||||
value == null ||
|
||||
typeof value === 'boolean' ||
|
||||
(typeof value === 'string' && !value.trim()),
|
||||
)
|
||||
)
|
||||
return null;
|
||||
const [west, south, east, north] = edges.map(Number);
|
||||
if (![west, south, east, north].every(Number.isFinite)) return null;
|
||||
return {
|
||||
west,
|
||||
|
||||
Reference in new issue
Block a user