Remove Spaces & Clear Stuff in Paragraphs

Working on removing spaces was quite an interesting task. I’m still very new at JavaScript, so I thought that this would be a cool task to do!

So, I had to make a module and test module for removing spaces, easy, right? Kinda. It was really easy to make the module that removes the spaces, but making the test was a new task for me.

The test cases for Empty Paragraphs

This was me writing the tests. Dave made a really good point about using a node package called “clean-whitespace”, it removes quite literally anything that looks like a space. So, I implemented this, and then remove all the spaces right after as a means to sanitize. It worked on my machine, so I made a PR on it.

The code to clean the whitespace

So, now that I’ve got the code, and the test to work, it passed everything through our CI-CD’s and it got merged! Yay!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store