Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when parsing external swearWords file #30

Open
rlevy12 opened this issue Dec 3, 2019 · 3 comments
Open

Issue when parsing external swearWords file #30

rlevy12 opened this issue Dec 3, 2019 · 3 comments

Comments

@rlevy12
Copy link
Contributor

rlevy12 commented Dec 3, 2019

Using the latest version of your demo code, plus the existing swearWords.json file, the browser produces an error message as follows:

Uncaught TypeError: badWords.concat(...).unique is not a function
at HTMLDivElement. (jquery.profanityfilter.js:148)
at Function.each (jquery.min.js:2)
at init.each (jquery.min.js:2)
at init.$.fn.profanityFilter (jquery.profanityfilter.js:122)
at profanity-original-demo.html:146

From what I can tell, the issue lies with this line:
var badWordsJSON = localStorage.getItem(localSwearsKey);
Where the results come back as """" (two actual quotes inside of a quoted string). This causes the next line to fail:
if (badWordsJSON === null) {

... because it really isn't null, it's a set of actual quotes. Changing the line to:
if (badWordsJSON === null || badWordsJSON == "\"\"") {
fixes the problem.

Thank you!

@ChaseFlorell
Copy link
Owner

hey Friend, it's been a very very long time since I've looked at this repo. I will absolutely accept a pull request if you know what the issue is and feel like fixing it.

@rlevy12
Copy link
Contributor Author

rlevy12 commented Dec 5, 2019

Hello Chase, thanks for your reply. I would love to create a pull request but I don't seem to be able to create a branch in this Github project in order to do so. I do have the fix committed in my local clone of this repo. Could you advise?

@ChaseFlorell
Copy link
Owner

ChaseFlorell commented Dec 5, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants