Thanks for searching for an old thread rather than making a new one! > I pattern match just a few keys of my map objects
Would just doing a direct pattern match work here? %{foo: foo, bar: bar} = my_map That would fail if foo or bar was missing in my_map. On Thu, May 24, 2018 at 1:11 PM Tallys Martins <tallysmart...@gmail.com> wrote: > Hi! > > I could not find a final reply for this thread, here nor at Github, so I > am here to ask and argue why this would be a useful function. > > I am writing some tests where I pattern match just a few keys of my map > objects using Map.take. Developers could type invalid keys and the tests > would still pass. > If you are open to receive an implementation for this I can work on it and > give my first piece of contribution. > > Sorry for reviving something deep in the past if its already solved. > > Warm Regards, > Tallys Martins > > > Em quarta-feira, 30 de novembro de 2016 21:25:18 UTC-2, Aaron Tinio > escreveu: >> >> Map.take!(map, keys) >> >> Same as Map.take/2 but raises a KeyError when one of the keys doesn't >> exist. >> > -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to elixir-lang-core+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/6c898b72-6626-4738-8331-cdee13cff251%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/6c898b72-6626-4738-8331-cdee13cff251%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAOMhEnwKOfH4scFO7JKK3nBqZUKj_CP9mV0km6%3D2gw%3D3UiNGQg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.