Rocky_Mountain_Vending/.pnpm-store/v10/files/b2/3f3262a91758adf77305b3832269b8b98b8b71608da4d5140b5959b8104e5ebb8c5717a309ce51bf27d2d2c68d9a7f84bb9c223956f12557c2695c99caeac3
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

18 lines
No EOL
721 B
Text

/**
* Takes an object with a hostname property (like a parsed URL) and some
* headers that may contain Host and returns the preferred hostname.
* @param parsed An object containing a hostname property.
* @param headers A dictionary with headers containing a `host`.
*/ export function getHostname(parsed, headers) {
// Get the hostname from the headers if it exists, otherwise use the parsed
// hostname.
let hostname;
if (headers?.host && !Array.isArray(headers.host)) {
hostname = headers.host.toString().split(':', 1)[0];
} else if (parsed.hostname) {
hostname = parsed.hostname;
} else return;
return hostname.toLowerCase();
}
//# sourceMappingURL=get-hostname.js.map