@freshworks/react-native-freshdesk-sdk
Version:
React Native wrapper for Freshdesk Android and iOS SDKs
23 lines (22 loc) • 599 B
JavaScript
/**
* Normalize a Freshdesk host URL.
* Accepts bare domains (yourcompany.freshdesk.com) or full URLs (https://...).
*/
export function normalizeFreshdeskHost(host) {
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) {
const trimmed = host.trim();
return trimmed.length > 0 && !/^https?:\/\//i.test(trimmed);
}
//# sourceMappingURL=normalizeHost.js.map