In this practice, you will use the DRY principle to abstract a pattern into a helper function.
Clone the practice from the starter.
Run npm install
to install all dependencies.
You will find four functions in the file practice.js. If you run npm test
now, you should see all the specs testing those four functions passing. Your job
is to look at the four functions and identify where you may be able to refactor
by creating a single helper function that is used in all four functions to help DRY
this code.
When you are sure that you have successfully refactored the code, run npm test
to see if the functions still return the correct information by making sure all
the test specs still pass.