From 9b68220bf7d8373a027769728cbb7f31676dbbe7 Mon Sep 17 00:00:00 2001 From: ivansg44 Date: Tue, 26 May 2020 12:30:22 -0700 Subject: [PATCH] Convert to title-case (#12) --- main.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.js b/main.js index fd6c9baa..54c32c99 100644 --- a/main.js +++ b/main.js @@ -23,6 +23,13 @@ const processData = (data) => { // Flat list of vocabulary items for autocomplete purposes if (child.vocabulary) { child.flatVocabulary = stringifyNestedVocabulary(child.vocabulary); + + // Convert to title case + for (const [i, val] of child.flatVocabulary.entries()) { + if (!val) continue; + child.flatVocabulary[i] = val.split(' ').map(x => + x.charAt(0).toUpperCase() + x.substr(1).toLowerCase()).join(' '); + } } } }