mirror of
https://github.com/upscayl/upscayl.git
synced 2024-11-13 18:30:54 +01:00
9 lines
255 B
TypeScript
9 lines
255 B
TypeScript
|
export default function getFilenameFromPath(
|
||
|
path: string,
|
||
|
withExtension: boolean = true,
|
||
|
) {
|
||
|
if (!path) return "";
|
||
|
if (withExtension) return path.split("/").slice(-1)[0];
|
||
|
return path.split("/").slice(-1)[0].split(".").slice(0, -1).join(".");
|
||
|
}
|