Skip to content

Commit bc6ef72

Browse files
committed
Added encodable_key type. Changed encodable to not use decoded.
1 parent 22de8ea commit bc6ef72

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/jason.ex

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defmodule Jason do
1515
@typedoc "The type of the value returned by the custom decoder function."
1616
@type map_key :: term
1717
@typedoc "Decoding setting for map keys."
18-
@type keys :: :atoms | :atoms! | :strings | :copy | (String.t() -> map_key)
18+
@type keys :: :atoms | :atoms! | :strings | :copy | (key :: String.t() -> map_key)
1919
@typedoc "Decoding setting for strings."
2020
@type strings :: :reference | :copy
2121
@typedoc "Decoding setting for floats."
@@ -29,8 +29,10 @@ defmodule Jason do
2929
@type value :: nil | String.t() | number | boolean | [value] | %{String.t() => value}
3030
@typedoc "A decoded JSON value where map keys can have any type."
3131
@type decoded :: [decoded] | %{map_key => decoded} | value
32-
@typedoc "The types that may be encoded. Only tuples are not included."
33-
@type encodable :: decoded | atom
32+
@typedoc "The map key types that can be encoded."
33+
@type encodable_key :: String.t() | number | atom | [encodable_key]
34+
@typedoc "The types that can be encoded. Not included are: `tuple`s, `function`s, `reference`s, `port`s and `pid`s."
35+
@type encodable :: String.t() | number | atom | [encodable] | %{encodable_key => encodable}
3436

3537
@doc """
3638
Parses a JSON value from `input` iodata.

0 commit comments

Comments
 (0)