mirror of
https://github.com/nodejs/node.git
synced 2025-08-20 17:35:43 +02:00

PR-URL: https://github.com/nodejs/node/pull/47862 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luke Karrys <luke@lukekarrys.com>
14 lines
456 B
JavaScript
14 lines
456 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.join = void 0;
|
|
const url_1 = require("url");
|
|
function join(base, path) {
|
|
return new url_1.URL(ensureTrailingSlash(base) + removeLeadingSlash(path)).toString();
|
|
}
|
|
exports.join = join;
|
|
function ensureTrailingSlash(path) {
|
|
return path.endsWith('/') ? path : path + '/';
|
|
}
|
|
function removeLeadingSlash(path) {
|
|
return path.startsWith('/') ? path.slice(1) : path;
|
|
}
|