Skip to content

Commit

Permalink
Convert to title-case (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivansg44 authored May 26, 2020
1 parent e18eade commit 9b68220
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(' ');
}
}
}
}
Expand Down

0 comments on commit 9b68220

Please sign in to comment.