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