Skip to content

Commit

Permalink
Added encodable_key type. Changed encodable to not use decoded.
Browse files Browse the repository at this point in the history
  • Loading branch information
azizk committed Oct 15, 2023
1 parent ffc600d commit 0b15a2c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/jason.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defmodule Jason do
@typedoc "The type of the value returned by the custom decoder function."
@type map_key :: term
@typedoc "Decoding setting for map keys."
@type keys :: :atoms | :atoms! | :strings | :copy | (String.t() -> map_key)
@type keys :: :atoms | :atoms! | :strings | :copy | (key :: String.t() -> map_key)
@typedoc "Decoding setting for strings."
@type strings :: :reference | :copy
@typedoc "Decoding setting for floats."
Expand All @@ -29,8 +29,10 @@ defmodule Jason do
@type value :: nil | String.t() | number | boolean | [value] | %{String.t() => value}
@typedoc "A decoded JSON value where map keys can have any type."
@type decoded :: [decoded] | %{map_key => decoded} | value
@typedoc "The types that may be encoded. Only tuples are not included."
@type encodable :: decoded | atom
@typedoc "The map key types that can be encoded."
@type encodable_key :: String.t() | number | atom | [encodable_key]
@typedoc "The types that can be encoded. Not included are: `tuple`s, `function`s, `reference`s, `port`s and `pid`s."
@type encodable :: String.t() | number | atom | [encodable] | %{encodable_key => encodable}

@doc """
Parses a JSON value from `input` iodata.
Expand Down

0 comments on commit 0b15a2c

Please sign in to comment.