Vite + TypeScript PWA that mirrors the Android app's core features: - Pre-processed shelter data (build-time UTM33N→WGS84 conversion) - Leaflet map with shelter markers, user location, and offline tiles - Canvas compass arrow (ported from DirectionArrowView.kt) - IndexedDB shelter cache with 7-day staleness check - Service worker with CacheFirst tiles and precached app shell - i18n for en, nb, nn (ported from Android strings.xml) - iOS/Android compass handling with low-pass filter - Respects user map interaction (no auto-snap on pan/zoom) - Build revision cache-breaker for reliable SW updates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
21 lines
498 B
JavaScript
21 lines
498 B
JavaScript
'use strict';
|
|
|
|
var $floor = require('math-intrinsics/floor');
|
|
|
|
// https://runestone.academy/ns/books/published/pythonds/BasicDS/ConvertingDecimalNumberstoBinaryNumbers.html#:~:text=The%20Divide%20by%202%20algorithm,have%20a%20remainder%20of%200
|
|
|
|
module.exports = function intToBinaryString(x) {
|
|
var str = '';
|
|
var y;
|
|
|
|
while (x > 0) {
|
|
y = x / 2;
|
|
x = $floor(y); // eslint-disable-line no-param-reassign
|
|
if (y === x) {
|
|
str = '0' + str;
|
|
} else {
|
|
str = '1' + str;
|
|
}
|
|
}
|
|
return str;
|
|
};
|