arangojs
Version:
The official ArangoDB JavaScript driver.
23 lines • 613 B
JavaScript
/**
* Utility function for normalizing URLs.
*
* @packageDocumentation
* @internal
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.normalizeUrl = void 0;
/**
* @internal
*/
function normalizeUrl(url) {
const raw = url.match(/^(tcp|ssl|tls)((?::|\+).+)/);
if (raw)
url = (raw[1] === "tcp" ? "http" : "https") + raw[2];
const unix = url.match(/^(?:(http|https)\+)?unix:\/\/(\/.+)/);
if (unix)
url = `${unix[1] || "http"}://unix:${unix[2]}`;
return url;
}
exports.normalizeUrl = normalizeUrl;
//# sourceMappingURL=normalizeUrl.js.map
;