Per “unit tests should be written regardless,” I do think it’s easier, as I think the unit test will already be written, making the use of
list.map(n => toReadableNumber(n)) obsolete. It’s additional effort at that point.
If the inspiration for
n => f(n) is safety, then the solution is unit testing. In addition to ease, I think it is safer to test code. We account not only for extended functionality of the library, but bugged implementations of upgraded dependencies.
I think the end of goal of the original article was safe deployments of software. I think achieving safety is a job for unit tests, not code style. Code style is prone to developer error/forgetfulness and difficult to maintain across onboarding and project hand-offs. It simply doesn’t scale.