JavaScript Implementation of the Code Climate 7 Ways To Refactory blog post