Can you spot any code smells in this code? Here’s a clue: a spot of Pol(l)ymorphism should improve matters!
Refactor this code, take small steps, run the tests often. See how small and beautiful and polymorphic you can make it.
This kata is based on @emilybache’s original kata and @keriati’s translation to JavaScript, but instead is an ECMAScript module (no transpiling) and uses the Node.js test runner (no dependencies). Watch Emily’s videos explaining this kata.
The code is heavily inspired by one of the examples in Martin Fowler’s book “Refactoring”. It‘s a classic, and if it‘s not on your bookshelf already treat yourself to a copy.