Recursively-Cleaning Parameters

One of the best ways I know to learn idiomatic patterns for programming is to read the source of libraries written by people who know what they’re doing. I do this every now and again and go spelunking for tips. I spotted this in page.js:

As in, if instead of a path and a callback the function is passed a callback and nothing else, we assume they meant to use the * path with the callback they passed. The function arranges the arguments into the right order, and calls itself. I call this pattern recursively-cleaning parameters.