1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-12 01:40:53 +01:00
upscayl/common/get-file-name.ts

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(".");
}