UNPKG

@freshworks/react-native-freshdesk-sdk

Version:
23 lines (21 loc) 591 B
/** * Normalize a Freshdesk host URL. * Accepts bare domains (yourcompany.freshdesk.com) or full URLs (https://...). */ export function normalizeFreshdeskHost(host: string): string { const trimmed = host.trim(); if (!trimmed) { return trimmed; } if (/^https?:\/\//i.test(trimmed)) { return trimmed; } return `https://${trimmed}`; } /** * Returns true when the host is a non-empty bare domain (no scheme). */ export function isBareFreshdeskHost(host: string): boolean { const trimmed = host.trim(); return trimmed.length > 0 && !/^https?:\/\//i.test(trimmed); }