function removeTrailingSeparator(path: string): string {
if (path.endsWith('/') || path.endsWith('\\')) {
return path.slice(0, -1);
}
return path;
}
console.log(removeTrailingSeparator('path/to/project/'));
console.log(removeTrailingSeparator('path\\to\\project\\'));
/*
run:
"path/to/project"
"path\to\project"
*/