I have the following test code to test pattern matching on functions sending a map as a parameter
defmodule TestMapAsParam do
def resolve(
%{"timezone" => timezone, "store_number" => store_number}
)
when is_binary(store_number) do
IO.puts "This is the #{timezone} and this is the #{store_number}"
end
end
timezone = "eastern"
store_number = 50001
TestMapAsParam.resolve(%{"timezone" => timezone, "store_number" => store_number})```
By testing this code running the elixir command in the terminal it throws the following error:
** (FunctionClauseError) no function clause matching in TestMapAsParam.resolve/1
The following arguments were given to TestMapAsParam.resolve/1:
# 1
%{"store_number" => 50001, "timezone" => "eastern"}
TEST_MAP_AS_PARAM.ex:2: TestMapAsParam.resolve/1
(elixir 1.13.1) lib/code.ex:1183: Code.require_file/2
As far as I understand the paramters I sent to the function doesn't match the ones on the declaration I did on the module?, can someeone help me to figure out how can I make it match? thanks for the help.
OS: MACos Venture 13.0.1
Elixir version: 1.13.1 with Erlang/OTP 24)