techprotrade's picture
Add scripts directory (part 4)
adb87a5 verified
Raw
History Blame Contribute Delete
253 Bytes
/**
* Removes everything after the last "/", but leaves the slash.
*/
export default function stripFilename(path: string | undefined | null): string {
if (!path) return '';
const index = path.lastIndexOf('/');
return path.slice(0, index + 1);
}