MCPcopy Create free account
hub / github.com/ImGoodBai/MapGoGoGo / bounds

Function bounds

frontend/src/maps.tsx:73–89  ·  view source on GitHub ↗
(cells: ChallengeCell[])

Source from the content-addressed store, hash-verified

71}
72
73function bounds(cells: ChallengeCell[]) {
74 if (cells.length === 0) return null;
75 let minLat = Number.POSITIVE_INFINITY;
76 let maxLat = Number.NEGATIVE_INFINITY;
77 let minLng = Number.POSITIVE_INFINITY;
78 let maxLng = Number.NEGATIVE_INFINITY;
79 for (const cell of cells) {
80 for (const [lat, lng] of safeCellBoundary(cell.cell_id)) {
81 minLat = Math.min(minLat, lat);
82 maxLat = Math.max(maxLat, lat);
83 minLng = Math.min(minLng, lng);
84 maxLng = Math.max(maxLng, lng);
85 }
86 }
87 if (!Number.isFinite(minLat)) return null;
88 return { minLat, maxLat, minLng, maxLng };
89}
90
91function safeCellBoundary(cellId: string) {
92 try {

Callers 1

MockMapFunction · 0.85

Calls 1

safeCellBoundaryFunction · 0.85

Tested by

no test coverage detected