2025-04-14 18:04:04 +08:00

19 lines
388 B
TypeScript

/* eslint-disable import/prefer-default-export */
export function joinPath(...paths: string[]): string {
let path = "";
paths.forEach((value) => {
if (!value) {
return;
}
if (!value.startsWith("/")) {
value = `/${value}`;
}
if (value.endsWith("/")) {
value = value.substring(0, value.length - 1);
}
path += value;
});
return path;
}