Than you all. I did implement a private method. I just thought I'd put out
there, the suggestion of making the `Map.get_lazy` method a little more
pipe friendly.
On Monday, March 20, 2017 at 9:41:43 AM UTC-4, José Valim wrote:
>
> That's not entirely accurate. In my case I was using a series of
>
> That's not entirely accurate. In my case I was using a series of pipes so
> I did not have access to the map. My case might be very niche, though.
>
All the capabilities all there. Not all functions in the standard library
can be pipable on all cases exactly as you want.
Define a private
You could define a helper function, for example:
defp map_get_any(map, keys), do: Enum.find_value(keys, (map, &1))
That could be used like this:
data
|> Poison.decode!
|> map_get_any(["foo", "bar"])
Michał.
On 20 Mar 2017, 12:53 +0100, David Long , wrote:
> Hi Ben,
>
Hi Ben,
My issue is specific to pipes. What I'm ultimately doing is taking a JSON
object, parsing it with Poison.decode!, And then attempting to pull a
single key out, either overrideoncall or oncall.
On Mon, Mar 20, 2017, 7:49 AM Ben Wilson wrote:
> Can you elaborate on
Can you elaborate on the code you have in mind? This sounds like a general
characteristic of pipes and not something specific to Map.get_lazy.
On Monday, March 20, 2017 at 6:48:46 AM UTC-4, David Long wrote:
>
> That's not entirely accurate. In my case I was using a series of pipes so
> I did
That's not entirely accurate. In my case I was using a series of pipes so I
did not have access to the map. My case might be very niche, though.
On Mon, Mar 20, 2017, 12:44 AM José Valim
wrote:
> The reason why get_lazy does not pass the map is because you