I've been using this library in my project and at every start of the application I add some 50 words to be blacklisted, and I noticed that the library will write to the profanity_words json 50 times, that's a lot of time to wait for 50 promises to be fulfilled, sequentially.
I have a suggestion, instead of writing to profanity_words.json every time there is a change, we should keep the user blacklisted/ whitelisted words in memory, which I see is already happening with profanityJson variable. The reason for this is that the users will anyhow have to make the blacklist/whitelist calls at application startup and writing to profanity_words.json is a redundant and expensive operation.
So, my suggestion is to either remove the updateProfanityJson function calls entirely, or have the option for user to configure this behavior. I'm willing to make the changes as well as test them.
What do you think?
I've been using this library in my project and at every start of the application I add some 50 words to be blacklisted, and I noticed that the library will write to the profanity_words json 50 times, that's a lot of time to wait for 50 promises to be fulfilled, sequentially.
I have a suggestion, instead of writing to profanity_words.json every time there is a change, we should keep the user blacklisted/ whitelisted words in memory, which I see is already happening with profanityJson variable. The reason for this is that the users will anyhow have to make the blacklist/whitelist calls at application startup and writing to profanity_words.json is a redundant and expensive operation.
So, my suggestion is to either remove the updateProfanityJson function calls entirely, or have the option for user to configure this behavior. I'm willing to make the changes as well as test them.
What do you think?