mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
11 lines
330 B
JavaScript
11 lines
330 B
JavaScript
/**
|
|
* Format a compass direction for the awareness overlay.
|
|
* @param {number} degrees
|
|
* @returns {string}
|
|
*/
|
|
export function formatAwarenessDirection(degrees) {
|
|
if (!Number.isFinite(degrees)) return '—';
|
|
const normalized = ((degrees % 360) + 360) % 360;
|
|
return String(Math.round(normalized) % 360).padStart(3, '0');
|
|
}
|