File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3333 - run : mix compile --warnings-as-errors
3434 - run : mix test --trace
3535 - run : mix coveralls.github
36+ if : matrix.combo.elixir == '1.19.5'
3637 env :
3738 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change @@ -27,8 +27,14 @@ defmodule SimpleEnum do
2727
2828 * `:allow_duplicate_keys` - when `true`, allows duplicate keys
2929 in the enumerators list. Defaults to `false`.
30+ Note: when duplicates exist, `name/1` and `name/2` will return
31+ the value of the first match (standard Keyword list behavior).
32+ `name_keys/0` returns deduplicated keys.
3033 * `:allow_duplicate_values` - when `true`, allows duplicate values
3134 in the enumerators list. Defaults to `false`.
35+ Note: when duplicates exist, `name/1` will return the first
36+ matching key for a given value.
37+ `name_values/0` returns deduplicated values.
3238
3339 The following macros are generated:
3440
@@ -124,8 +130,8 @@ defmodule SimpleEnum do
124130 @ name unquote ( expanded_name )
125131 @ enum_name unquote ( enum_name )
126132 @ fields unquote ( fields )
127- @ keys unquote ( keys )
128- @ values unquote ( values )
133+ @ keys unquote ( Enum . uniq ( keys ) )
134+ @ values unquote ( Enum . uniq ( values ) )
129135 @ fields_rev @ fields
130136 |> Enum . map ( fn { k , v } -> { v , k } end )
131137 |> Map . new ( )
You can’t perform that action at this time.
0 commit comments