Destructure map keys, and also rest of the map?

Nice! Your solution was simpler indeed.

I agree with your point on generality, this is pleasant to be able to stick in the suitable namespace.