add {incomplete, ...}
to return types of core jsx functions
`encode`, `decode`, `format`, `prettify` and `minify` were incompletely specified closes #27
This commit is contained in:
parent
fe67eb5b26
commit
21011964da
1 changed files with 8 additions and 8 deletions
16
src/jsx.erl
16
src/jsx.erl
|
@ -52,8 +52,8 @@
|
||||||
-type json_text() :: binary().
|
-type json_text() :: binary().
|
||||||
|
|
||||||
|
|
||||||
-spec encode(Source::json_term()) -> json_text().
|
-spec encode(Source::json_term()) -> json_text() | {incomplete, encoder()}.
|
||||||
-spec encode(Source::json_term(), Opts::jsx_to_json:opts()) -> json_text().
|
-spec encode(Source::json_term(), Opts::jsx_to_json:opts()) -> json_text() | {incomplete, encoder()}.
|
||||||
|
|
||||||
encode(Source) -> encode(Source, []).
|
encode(Source) -> encode(Source, []).
|
||||||
encode(Source, Opts) -> jsx_to_json:to_json(Source, Opts).
|
encode(Source, Opts) -> jsx_to_json:to_json(Source, Opts).
|
||||||
|
@ -66,25 +66,25 @@ term_to_json(Source) -> encode(Source, []).
|
||||||
term_to_json(Source, Opts) -> encode(Source, Opts).
|
term_to_json(Source, Opts) -> encode(Source, Opts).
|
||||||
|
|
||||||
|
|
||||||
-spec format(Source::json_text()) -> json_text().
|
-spec format(Source::json_text()) -> json_text() | {incomplete, decoder()}.
|
||||||
-spec format(Source::json_text(), Opts::jsx_to_json:opts()) -> json_text().
|
-spec format(Source::json_text(), Opts::jsx_to_json:opts()) -> json_text() | {incomplete, decoder()}.
|
||||||
|
|
||||||
format(Source) -> format(Source, []).
|
format(Source) -> format(Source, []).
|
||||||
format(Source, Opts) -> jsx_to_json:format(Source, Opts).
|
format(Source, Opts) -> jsx_to_json:format(Source, Opts).
|
||||||
|
|
||||||
|
|
||||||
-spec minify(Source::json_text()) -> json_text().
|
-spec minify(Source::json_text()) -> json_text() | {incomplete, decoder()}.
|
||||||
|
|
||||||
minify(Source) -> format(Source, []).
|
minify(Source) -> format(Source, []).
|
||||||
|
|
||||||
|
|
||||||
-spec prettify(Source::json_text()) -> json_text().
|
-spec prettify(Source::json_text()) -> json_text() | {incomplete, decoder()}.
|
||||||
|
|
||||||
prettify(Source) -> format(Source, [space, {indent, 2}]).
|
prettify(Source) -> format(Source, [space, {indent, 2}]).
|
||||||
|
|
||||||
|
|
||||||
-spec decode(Source::json_text()) -> json_term().
|
-spec decode(Source::json_text()) -> json_term() | {incomplete, decoder()}.
|
||||||
-spec decode(Source::json_text(), Opts::jsx_to_term:opts()) -> json_term().
|
-spec decode(Source::json_text(), Opts::jsx_to_term:opts()) -> json_term() | {incomplete, decoder()}.
|
||||||
|
|
||||||
decode(Source) -> decode(Source, []).
|
decode(Source) -> decode(Source, []).
|
||||||
decode(Source, Opts) -> jsx_to_term:to_term(Source, Opts).
|
decode(Source, Opts) -> jsx_to_term:to_term(Source, Opts).
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue