sop-nuxt/utils/fileNameParser.ts
2025-07-13 16:29:02 +02:00

14 lines
406 B
TypeScript

export const toTitleCaseWithSpaces = (input: string): string => {
return input
.replace(/[-_]/g, " ")
.split(" ")
.filter(Boolean)
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
.join(" ");
};
export const parseImageName = (fileName: string): string => {
// Extract the name without the extension
return fileName.split(".").slice(0, -1).join(".");
};