minor fixups to spec/api
This commit is contained in:
parent
6c3aee2835
commit
affdd3cc62
2 changed files with 3 additions and 7 deletions
|
@ -78,12 +78,11 @@
|
||||||
%% this probably doesn't work properly
|
%% this probably doesn't work properly
|
||||||
-type jsx_decoder() :: fun((binary()) -> jsx_iterator_result()).
|
-type jsx_decoder() :: fun((binary()) -> jsx_iterator_result()).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-type jsx_encoder() :: fun((jsx_encodeable()) -> jsx_iterator_result()).
|
-type jsx_encoder() :: fun((jsx_encodeable()) -> jsx_iterator_result()).
|
||||||
|
|
||||||
-type jsx_iterator_result() ::
|
-type jsx_iterator_result() ::
|
||||||
{jsx, jsx_event(), fun(() -> jsx_iterator_result())}
|
{jsx, jsx_event(), fun(() -> jsx_iterator_result())}
|
||||||
|
| {jsx, [jsx_event()], fun(() -> jsx_iterator_result())}
|
||||||
| {jsx, incomplete, jsx_iterator()}
|
| {jsx, incomplete, jsx_iterator()}
|
||||||
| {error, {badjson, any()}}.
|
| {error, {badjson, any()}}.
|
||||||
|
|
||||||
|
|
|
@ -35,17 +35,14 @@
|
||||||
|
|
||||||
|
|
||||||
-spec is_json(JSON::binary(), Opts::verify_opts()) -> true | false
|
-spec is_json(JSON::binary(), Opts::verify_opts()) -> true | false
|
||||||
; (Terms::list(jsx_encodeable()), Opts::verify_opts()) -> true | false
|
; (Terms::list(jsx_encodeable()), Opts::verify_opts()) -> true | false.
|
||||||
; (F::jsx_iterator(), Opts::verify_opts()) -> true | false.
|
|
||||||
|
|
||||||
is_json(JSON, OptsList) when is_binary(JSON) ->
|
is_json(JSON, OptsList) when is_binary(JSON) ->
|
||||||
F = jsx:decoder(extract_parser_opts(OptsList)),
|
F = jsx:decoder(extract_parser_opts(OptsList)),
|
||||||
verify(F(JSON), parse_opts(OptsList));
|
verify(F(JSON), parse_opts(OptsList));
|
||||||
is_json(JSON, OptsList) when is_list(JSON) ->
|
is_json(JSON, OptsList) when is_list(JSON) ->
|
||||||
F = jsx:encoder(extract_parser_opts(OptsList)),
|
F = jsx:encoder(extract_parser_opts(OptsList)),
|
||||||
verify(F(JSON), parse_opts(OptsList));
|
verify(F(JSON), parse_opts(OptsList)).
|
||||||
is_json(F, OptsList) when is_function(F) ->
|
|
||||||
verify(jsx_utils:collect(F), parse_opts(OptsList)).
|
|
||||||
|
|
||||||
|
|
||||||
extract_parser_opts(Opts) ->
|
extract_parser_opts(Opts) ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue