From 4dd1a344c6474087a3f8782dd54f5c7b4acc67ed Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Wed, 23 Aug 2023 00:24:50 +0200 Subject: area connections and town maps --- resources/js/helpers.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'resources/js/helpers.js') 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(' '); } /** -- cgit v1.2.3