datasquirel/engine/engine/utils/slugToCamelTitle.js

17 lines
421 B
JavaScript
Raw Normal View History

2023-08-12 13:36:18 +00:00
// @ts-check
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;
}
};