dsql-admin/dsql-app/shell/utils/slugToCamelTitle.js
2024-11-05 12:12:42 +01:00

19 lines
493 B
JavaScript
Executable File

// @ts-check
module.exports = function slugToCamelTitle(/** @type {String} */ 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;
}
};