@segment/analytics-node
Version:
https://www.npmjs.com/package/@segment/analytics-node
15 lines • 499 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.tryCreateFormattedUrl = void 0;
const stripTrailingSlash = (str) => str.replace(/\/$/, '');
/**
*
* @param host e.g. "http://foo.com"
* @param path e.g. "/bar"
* @returns "e.g." "http://foo.com/bar"
*/
const tryCreateFormattedUrl = (host, path) => {
return stripTrailingSlash(new URL(path || '', host).href);
};
exports.tryCreateFormattedUrl = tryCreateFormattedUrl;
//# sourceMappingURL=create-url.js.map