summaryrefslogtreecommitdiff
path: root/resources/js/helpers.js
diff options
context:
space:
mode:
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(' ');
}
/**