Our current new users are automatically given a username like Guest1, Guest99.
It would be great if we could change this to generate a username that follows this format ${Adjective}${Animal}${Number}.
An example would be Guest1 would be given AwesomePanther1
We currently have a express backend, with react.
I have tidied a list of animal words to use currently in a .txt and was thinking of reading the local text file something like:
let fr = new FileReader();
fr.onload = function () {
document.getElementById('output').textContent = fr.result;
}
fr.readAsText("/animalsWordList.txt");
animalsWordList.txt contents would look like:
dog(enter)
cat(enter)
fish(enter)
The same would be done with a 2nd text file for adjective, then just concat the 3 substrings together.
Is this the most performant way of reading text for this use case? Especially if the lists get really long, maybe 700 animal words, and 1000-2000 adjectives?
Would it be better to format the data as a .js file that exports a JSON containing two arrays with this data?
In this case, we would use an import statement.
To clarify, we’re not worried about uniqueness of the username right now – so, no querying databases is needed to check if PinkPanda3 is taken at this part of the user flow.
I have tried the JSON export method to bring in large arrays for another feature in this project so we know this implementation works. Our main question is which will be more performant.
