Son CV dans un terminal web en Javascript!
https://terminal-cv.gregandev.fr
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.0 KiB
46 lines
1.0 KiB
1 year ago
|
"use strict";
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.default = urlJoin;
|
||
|
|
||
|
function _url() {
|
||
|
const data = _interopRequireDefault(require("url"));
|
||
|
|
||
|
_url = function () {
|
||
|
return data;
|
||
|
};
|
||
|
|
||
|
return data;
|
||
|
}
|
||
|
|
||
|
function _path() {
|
||
|
const data = _interopRequireDefault(require("path"));
|
||
|
|
||
|
_path = function () {
|
||
|
return data;
|
||
|
};
|
||
|
|
||
|
return data;
|
||
|
}
|
||
|
|
||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
|
||
|
/**
|
||
|
* Joins a path onto a URL, and normalizes Windows paths
|
||
|
* e.g. from \path\to\res.js to /path/to/res.js.
|
||
|
*/
|
||
|
function urlJoin(publicURL, assetPath) {
|
||
|
const url = _url().default.parse(publicURL, false, true); // Leading / ensures that paths with colons are not parsed as a protocol.
|
||
|
|
||
|
|
||
|
let p = assetPath.startsWith('/') ? assetPath : '/' + assetPath;
|
||
|
|
||
|
const assetUrl = _url().default.parse(p);
|
||
|
|
||
|
url.pathname = _path().default.posix.join(url.pathname, assetUrl.pathname);
|
||
|
url.search = assetUrl.search;
|
||
|
url.hash = assetUrl.hash;
|
||
|
return _url().default.format(url);
|
||
|
}
|