dsql-admin/dsql-app/package-shared/utils/slugToCamelTitle.js
Benjamin Toby 8b7ea057d0 Updates
2024-12-06 14:24:26 +01:00

24 lines
523 B
JavaScript

// @ts-check
/**
*
* @param {string} text
* @returns
*/
module.exports = function slugToCamelTitle(text) {
if (text) {
let addArray = text.split("-").filter((item) => item !== "");
let camelArray = addArray.map((item) => {
return (
item.substr(0, 1).toUpperCase() + item.substr(1).toLowerCase()
);
});
let parsedAddress = camelArray.join(" ");
return parsedAddress;
} else {
return null;
}
};