datasquirel/package-shared/utils/slugToCamelTitle.ts
2025-01-10 20:10:28 +01:00

21 lines
524 B
TypeScript

/**
* # Slug to Camel case Title
*/
export default function slugToCamelTitle(text: String) {
if (text) {
let addArray = text.split("-").filter((item) => item !== "");
let camelArray = addArray.map((item) => {
return (
item.substring(0, 1).toUpperCase() +
item.substring(1).toLowerCase()
);
});
let parsedAddress = camelArray.join(" ");
return parsedAddress;
} else {
return null;
}
}