Skip to content
Permalink
Browse files

simpify code of list comprehension

  • Loading branch information
Maples7 committed Jun 18, 2019
1 parent 5e4d929 commit fa039386be8b953e8ec927408a880301fc5283cb
Showing with 8 additions and 13 deletions.
  1. +8 −13 lib/field_mask.ex
@@ -41,13 +41,11 @@ defmodule FieldMask do
data

["*"] ->
data
|> Map.keys()
|> (fn keys ->
for key <- keys, into: %{} do
{key, reveal(tree["*"], data[key])}
end
end).()
keys = Map.keys(data)

for key <- keys, into: %{} do
{key, reveal(tree["*"], data[key])}
end

keys ->
case data do
@@ -57,12 +55,9 @@ defmodule FieldMask do
end

data when is_map(data) ->
keys
|> (fn keys ->
for key <- keys, into: %{} do
{key, reveal(tree[key], data[key])}
end
end).()
for key <- keys, into: %{} do
{key, reveal(tree[key], data[key])}
end
end
end).()
end

0 comments on commit fa03938

Please sign in to comment.
You can’t perform that action at this time.