2023-03-14 09:51:20 +00:00
|
|
|
export function pathEscapeSegments(s) {
|
|
|
|
return s.split('/').map(encodeURIComponent).join('/');
|
|
|
|
}
|
2024-03-08 15:15:58 +00:00
|
|
|
|
|
|
|
function stripSlash(url) {
|
|
|
|
return url.endsWith('/') ? url.slice(0, -1) : url;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function isUrl(url) {
|
|
|
|
try {
|
|
|
|
return stripSlash((new URL(url).href)).trim() === stripSlash(url).trim();
|
|
|
|
} catch {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|