summaryrefslogtreecommitdiff
path: root/resources/js/helpers.js
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-08-23 00:24:50 +0200
committerDaniel Weipert <code@drogueronin.de>2023-08-23 00:24:50 +0200
commit4dd1a344c6474087a3f8782dd54f5c7b4acc67ed (patch)
tree7a0229eb721d81c7579a7f5f721a503136c98095 /resources/js/helpers.js
parentdbcd0118863ff3e7c5bee45041ccdb757eb2f366 (diff)
area connections and town maps
Diffstat (limited to 'resources/js/helpers.js')
-rw-r--r--resources/js/helpers.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/resources/js/helpers.js b/resources/js/helpers.js
index 2395878..e9cb37d 100644
--- a/resources/js/helpers.js
+++ b/resources/js/helpers.js
@@ -4,7 +4,13 @@
* @returns {(string|MonsterSlug|TechniqueSlug)}
*/
function slugToName (slug) {
- return slug.split('_').map((item) => item.charAt(0).toUpperCase() + item.slice(1)).join(' ');
+ const ucfirst = (str) => {
+ return str.charAt(0).toUpperCase() + str.slice(1);
+ };
+
+ return slug
+ .split('_').map((item) => ucfirst(item)).join(' ')
+ .split('-').map((item) => ucfirst(item)).join(' ');
}
/**