Skip to content

Commit cb02130

Browse files
committed
a bit more examples
1 parent 3b7bfc3 commit cb02130

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
# AtomicMap
22

3-
A small helper to convert deep hashes with mixed string/atom keys to atom-only keyed maps. Optionally with a safe option, to prevent [atom space exhaustion of the Erlang VM](https://erlangcentral.org/wiki/index.php?title=String_Conversion_To_Atom).
3+
A small helper to convert deep Elixir maps with mixed string/atom keys to atom-only keyed maps. Optionally with a safe option, to prevent [atom space exhaustion of the Erlang VM](https://erlangcentral.org/wiki/index.php?title=String_Conversion_To_Atom).
44

55
## Usage
66

77

88
```elixir
99
iex> AtomicMap.convert(%{"a" => 2, "b" => %{"c" => 4}}, safe: true)
1010
%{a: 2, b: %{c: 4}}
11-
```
11+
12+
iex> AtomicMap.convert([ %{"c" => 1}, %{:c => 2}, %{"c" => %{:b => 4}}], safe: true]
13+
[%{c: 1}, %{c: 2}, %{c: %{b: 4}}]
1214

1315

16+
iex> AtomicMap.convert(%{ "a" => [ %{"c" => 1}, %{"c" => 2}] }, safe: true]
17+
%{a: [%{c: 1}, %{c: 2}] }
18+
19+
```
1420

1521

1622
## Installation

0 commit comments

Comments
 (0)