added state message formatting

This commit is contained in:
plebbitor
2023-04-23 11:46:14 +02:00
parent 2760171d8b
commit 8e9708a442
5 changed files with 23 additions and 9 deletions
+18
View File
@@ -0,0 +1,18 @@
function formatState(str) {
return (
str
.replace(/-/g, " ")
.split(" ")
.map((word) => {
word = word.toLowerCase();
if (word === "ipfs" || word === "ipns") {
return word.toUpperCase();
} else {
return word.charAt(0).toUpperCase() + word.slice(1);
}
})
.join(" ") + "..."
);
}
export default formatState;