Magik.Params.scrub_param

You're seeing just the function scrub_param, go back to Magik.Params module for more information.

Convert all parameter which value is empty string or string with all whitespace to nil. It works with nested map and list too.

Example

params = %{"keyword" => "   ", "email" => "", "type" => "customer"}
Magik.Params.scrub_param(params)
# => %{"keyword" => nil, "email" => nil, "type" => "customer"}

params = %{user_ids: [1, 2, "", "  "]}
Magik.Params.scrub_param(params)
# => %{user_ids: [1, 2, nil, nil]}