14 lines
406 B
TypeScript
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(".");
|
|
};
|