chore: initial Observable workspace with technical README

This commit is contained in:
Kerboul
2026-03-19 16:28:35 +01:00
commit c390caf2e2
16 changed files with 4980 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
const csvUrl =
"https://raw.githubusercontent.com/madmao/castle-compass/master/csv/In%20N%20Out.csv";
const response = await fetch(csvUrl);
if (!response.ok) {
throw new Error(`In-N-Out CSV request failed: ${response.status}`);
}
const rows = (await response.text()).split(/\r?\n/).filter(Boolean);
const stores = rows
.map((line, index) => {
const [latRaw, lonRaw] = line.split(",");
const latitude = Number(latRaw);
const longitude = Number(lonRaw);
if (!Number.isFinite(latitude) || !Number.isFinite(longitude)) return null;
const inCaliforniaBounds =
latitude >= 32 &&
latitude <= 42.5 &&
longitude >= -125 &&
longitude <= -114;
if (!inCaliforniaBounds) return null;
return {
id: `ino/${index}`,
name: "In-N-Out Burger",
latitude,
longitude,
};
})
.filter(Boolean);
const dedup = new Map();
for (const store of stores) {
const key = `${store.latitude.toFixed(5)},${store.longitude.toFixed(5)}`;
if (!dedup.has(key)) dedup.set(key, store);
}
process.stdout.write(JSON.stringify(Array.from(dedup.values())));