UNPKG

@kiwicom/smart-faq

Version:
30 lines (24 loc) 616 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = exports.replaceDomain = void 0; // @flow var replaceDomain = function replaceDomain(link /*: string*/ , domain /*: string*/ ) { return link.replace(/(https?:\/\/)[^/]+(.*)/, "".concat(domain, "$2")); }; exports.replaceDomain = replaceDomain; var replaceWithCurrentDomain = function replaceWithCurrentDomain(url /*: string*/ ) { if (typeof window === 'undefined') { return url; } return replaceDomain(url, window.location.origin); }; var _default = replaceWithCurrentDomain; exports.default = _default;