arangojs
Version:
The official ArangoDB JavaScript driver.
19 lines • 475 B
JavaScript
/**
* Utility function for normalizing URLs.
*
* @packageDocumentation
* @internal
*/
/**
* @internal
*/
export 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;
}
//# sourceMappingURL=normalizeUrl.js.map