Skip to content

Commit

Permalink
add list_tuple_to_unique_keys/1 usage example to README.md #59
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Oct 4, 2023
1 parent 3ad62d0 commit 1dce25e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Install by adding `useful` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:useful, "~> 1.13.1"}
{:useful, "~> 1.14.0"}
]
end
```
Expand Down Expand Up @@ -148,6 +148,20 @@ person_id = conn.assigns.person.id || 0
But `Elixir` "_Me no likey_" ...
So this is what we have.

### `list_tuple_to_unique_keys/1`

Turns a list of tuples with the _same_ key
into a list of tuples with _unique_ keys.
Useful when dealing with "multipart" forms
that upload multiple files. e.g:

```elixir
parts = [{"file", "pic1.png"}, {"file", "pic2.png"}]
Useful.list_tuples_to_unique_keys(parts)
[{"file-1", "pic1.png"}, {"file-2", "pic2.png"}]
```



### `remove_item_from_list/2`

Expand Down

0 comments on commit 1dce25e

Please sign in to comment.