svelte.sk-auth/src/path.ts

6 lines
200 B
TypeScript
Raw Normal View History

export function join(parts: string[], sep = "/") {
const separator = sep || "/";
const replace = new RegExp(separator + "{1,}", "g");
return parts.join(separator).replace(replace, separator);
}