removes useless eventify function

This commit is contained in:
alisdair sullivan 2011-04-16 22:25:02 -07:00
parent e22ec34000
commit 6481bae328
2 changed files with 14 additions and 17 deletions

View file

@ -30,7 +30,6 @@
-export([json_to_term/1, json_to_term/2]).
-export([is_json/1, is_json/2]).
-export([format/1, format/2]).
-export([eventify/1]).
-include("./include/jsx_common.hrl").
@ -117,20 +116,6 @@ format(JSON, Opts) ->
jsx_format:format(JSON, Opts).
-spec eventify(List::list()) -> jsx_parser_result().
eventify([]) ->
fun() ->
{incomplete, fun(List) when is_list(List) ->
eventify(List)
; (_) ->
erlang:error(badarg)
end}
end;
eventify([Next|Rest]) ->
fun() -> {event, Next, eventify(Rest)} end.
-ifdef(TEST).

View file

@ -60,10 +60,22 @@ term_to_json(List, Opts) ->
; false -> continue
end,
Encoding = proplists:get_value(encoding, Opts, utf8),
jsx:format(jsx:eventify(lists:reverse([end_json] ++ term_to_events(List))),
jsx:format(eventify(lists:reverse([end_json] ++ term_to_events(List))),
[{output_encoding, Encoding}] ++ Opts
).
eventify([]) ->
fun() ->
{incomplete, fun(List) when is_list(List) ->
eventify(List)
; (_) ->
erlang:error(badarg)
end}
end;
eventify([Next|Rest]) ->
fun() -> {event, Next, eventify(Rest)} end.
extract_parser_opts(Opts) ->
extract_parser_opts(Opts, []).