Initial commit
This commit is contained in:
commit
78f8d225ee
21173 changed files with 2907774 additions and 0 deletions
40
node_modules/next/dist/shared/lib/router/utils/relativize-url.js
generated
vendored
Normal file
40
node_modules/next/dist/shared/lib/router/utils/relativize-url.js
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* The result of parsing a URL relative to a base URL.
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
getRelativeURL: null,
|
||||
parseRelativeURL: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
getRelativeURL: function() {
|
||||
return getRelativeURL;
|
||||
},
|
||||
parseRelativeURL: function() {
|
||||
return parseRelativeURL;
|
||||
}
|
||||
});
|
||||
function parseRelativeURL(url, base) {
|
||||
const baseURL = typeof base === 'string' ? new URL(base) : base;
|
||||
const relative = new URL(url, base);
|
||||
// The URL is relative if the origin is the same as the base URL.
|
||||
const isRelative = relative.origin === baseURL.origin;
|
||||
return {
|
||||
url: isRelative ? relative.toString().slice(baseURL.origin.length) : relative.toString(),
|
||||
isRelative
|
||||
};
|
||||
}
|
||||
function getRelativeURL(url, base) {
|
||||
const relative = parseRelativeURL(url, base);
|
||||
return relative.url;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=relativize-url.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue