Is this code idiomatic Elixir/functional?

Was hoping somebody had posted this method - too often the beauty of pattern matching in function heads is forgotten! :stuck_out_tongue: