I wanted to stick to writing regression tests for all bugs we fix, so I did a refactor to make some pure functions that are more easily testable, I'll comment where the actual change is.
I actually really like this structure of my refactor, think we should do more of it, trying to isolate all the side effects in a few functions and then extract all the pure logic behaviour out into separate functions that are easily unit testable
Also, this kind of coding and API is making me think that it might actually be worth adding Typescript incrementally, it would be really helpful for stuff like this, think I may actually do that
I wanted to stick to writing regression tests for all bugs we fix, so I did a refactor to make some pure functions that are more easily testable, I'll comment where the actual change is.
I actually really like this structure of my refactor, think we should do more of it, trying to isolate all the side effects in a few functions and then extract all the pure logic behaviour out into separate functions that are easily unit testable