FLUJOS/VISUALIZACION/node_modules/parcel-bundler/lib/utils/urlJoin.js
2025-11-07 00:06:12 +01:00

17 lines
No EOL
484 B
JavaScript
Executable file

'use strict';
const URL = require('url');
const path = require('path');
/**
* Joins a path onto a URL, and normalizes Windows paths
* e.g. from \path\to\res.js to /path/to/res.js.
*/
module.exports = function (publicURL, assetPath) {
const url = URL.parse(publicURL, false, true);
const assetUrl = URL.parse(assetPath);
url.pathname = path.posix.join(url.pathname, assetUrl.pathname);
url.search = assetUrl.search;
url.hash = assetUrl.hash;
return URL.format(url);
};