full site update

This commit is contained in:
2025-07-24 18:46:24 +02:00
parent bfe2b90d8d
commit 37a6e0ab31
6912 changed files with 540482 additions and 361712 deletions

View File

@@ -10,6 +10,13 @@ function prependForwardSlash(path) {
function collapseDuplicateSlashes(path) {
return path.replace(/(?<!:)\/{2,}/g, "/");
}
const MANY_TRAILING_SLASHES = /\/{2,}$/g;
function collapseDuplicateTrailingSlashes(path, trailingSlash) {
if (!path) {
return path;
}
return path.replace(MANY_TRAILING_SLASHES, trailingSlash ? "/" : "") || "/";
}
function removeTrailingForwardSlash(path) {
return path.endsWith("/") ? path.slice(0, path.length - 1) : path;
}
@@ -77,11 +84,18 @@ function removeBase(path, base) {
}
return path;
}
const WITH_FILE_EXT = /\/[^/]+\.\w+$/;
function hasFileExtension(path) {
return WITH_FILE_EXT.test(path);
}
export {
MANY_TRAILING_SLASHES,
appendExtension,
appendForwardSlash,
collapseDuplicateSlashes,
collapseDuplicateTrailingSlashes,
fileExtension,
hasFileExtension,
isRelativePath,
isRemotePath,
joinPaths,