dsql-admin/dsql-app/package-shared/shell/utils/slugToCamelTitle.js

19 lines
493 B
JavaScript
Raw Permalink Normal View History

2024-12-06 13:24:26 +00:00
// @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;
}
};