Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
744 B ยท 28 lines
TypeScript
1234567891011121314151617181920212223242526272829import { regions } from "../regions/vercel";import type { ParserReturn, Region } from "../types";
export function parseXVercelId(header: string): ParserReturn<Region[]> { const regex = /([a-z]{3}[0-9])+:+/g;
const arr = header.match(regex); if (!arr || !arr.length) { return { status: "failed", error: new Error("Couldn't parse the header.") }; }
const data: Region[] = []; for (const r of arr) { const regionId = r.replace(/:+/, ""); const region = regions[regionId]; if (!region) { return { status: "failed", error: new Error( `It seems like the region '${regionId}' is not listed.`, ), }; } data.push(region); }
return { status: "success", data };}