elixir-lang/elixir — pull request #1633 by chrismccord (2013-08-21 03:07:11+00:00)
Title: Add Keyword.slice to filter keywords by a list of keys.

This is useful for limiting a keyword list to contain only valid keys. I find myself needing this for model field protection from an arbitrary keyword list, but I think general use cases to trim down a keyword list to only desired keys is a good fit for the standard lib. Thoughts?

Examples
```elixir
iex> Keyword.slice([name: "Elixir", age: 2, admin: true], [:name, :age])
[name: "Elixir", age: 2]

iex> Keyword.slice([name: "Elixir", age: 2, admin: true], [:name, :age, :email, :newsletter])
[name: "Elixir", age: 2]
```