Password strength checker

Me again…

I have done the majority of the code. I am now working on getting the progress bar to update. Does anyone know if there is an easy way to update the progress bar than doing a huge if statement…?

if (uppercaseLetters < 1) this.setState({ percentage: 5 })

Then that percentage gets passed to a progress bar component. But if I was do to do this for every instance, it would get very repetitive and not the most semantic…

if (uppercaseLetters < 1) this.setState({ percentage: 5 })
if (uppercaseLetters >= 1 && uppercaseLetters <= 5) this.setState({ percentage: 10 })

if (lowercaseLetters <= 10) this.setState({ percentage: 5 })
if (lowercaseLetters >= 10 && uppercaseLetters <= 15) this.setState({ percentage: 10 })

if (numbers <= 1) this.setState({ percentage: 5 })
if (numbers >= 1 && numbers <= 5) this.setState({ percentage: 10 })

As you can see, this is very repetitive…

How are you determining the percentage for each letter? What is the general algorithm/formula you are using?

so you already have a topic on this project? could you please keep using that one?

I can merge the posts from this topic to that one so the conversation can keep going from

This is the thread from before. Not sure if they should be merged or not.