DEV Community

Rudy Chung
Rudy Chung

Posted on

My Fourth Hacktoberfest PR

What Did I Work on?

This week, I worked on a new repo word-cloud-generator. This project allows the user to generate a word cloud based on a body of text provided to it. This word cloud can be generated using different methods and with different stylings and can be saved as a .png file.

The issue I worked on was adding a feature that allowed for selecting the capitalisation of the words in the generated word cloud. This allowed for all words in the word cloud to be all lower-case, all upper-case, or have only the first letter capitalised.

What Changes did I make?

My pull request involved making changes to both the front-end and back-end. The front-end changes I made were relatively simple, just placing radio buttons and labels on the settings panel of the page.
Front-end changes
On the back-end, the default capitalisation was all lower-case, which was where I started. I had to first check the radio button that was checked, then modify the words received in the corresponding way.

All upper-case

There was not a built-in method to capitalize the first letter in every word, so I had to find my own solution. This involved iterating through every word, and modifying them to a value built from appending the capitalised first letter to the remainder of the word.
First letter upper-case

Difficulties

This project used webpack, which caches the page. This also made it so that my changes were not being made when I reloaded the page. It took me a few hours to figure out, but once I found a workaround the process of finding the solution to the issue was only a matter of time.

Top comments (0)