Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
novaugust committed Dec 7, 2023
1 parent c774274 commit 3c4fa2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/style/pipes.ex
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@ defmodule Styler.Style.Pipes do
end

for mod <- [:Map, :Keyword] do
# Map.merge(foo, %{one_key: :bar}) => Map.put(foo, :one_key, :bar)
# lhs |> Map.merge(%{key: value}) => lhs |> Map.put(key, value)
defp fix_pipe({:|>, pm, [lhs, {{:., dm, [{_, _, [unquote(mod)]} = module, :merge]}, m, [{:%{}, _, [{key, value}]}]}]}),
do: {:|>, pm, [lhs, {{:., dm, [module, :put]}, m, [key, value]}]}

# Map.merge(foo, one_key: :bar) => Map.put(foo, :one_key, :bar)
# lhs |> Map.merge(key: value) => lhs |> Map.put(:key, value)
defp fix_pipe({:|>, pm, [lhs, {{:., dm, [{_, _, [unquote(mod)]} = module, :merge]}, m, [[{key, value}]]}]}),
do: {:|>, pm, [lhs, {{:., dm, [module, :put]}, m, [key, value]}]}
end
Expand Down

0 comments on commit 3c4fa2c

Please sign in to comment.