From 485c4d74ea84273bb0df32deaec094ada057f1cb Mon Sep 17 00:00:00 2001 From: alisdair sullivan Date: Thu, 12 Aug 2010 20:55:07 -0700 Subject: [PATCH] fixed a misleading comment about eventify --- src/jsx.erl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/jsx.erl b/src/jsx.erl index 0616036..4a8cbf4 100644 --- a/src/jsx.erl +++ b/src/jsx.erl @@ -110,10 +110,11 @@ format(JSON, Opts) -> -spec eventify(List::list()) -> jsx_parser_result(). -%% fake the jsx api with a closure to be passed to the pretty printer +%% fake the jsx api for any list, useful if you want to serialize a structure to +%% json using the pretty printer, or verify a sequence could be valid json eventify([]) -> - fun() -> {incomplete, fun(end_stream) -> eventify([]) end} end; + fun() -> {incomplete, fun(List) when is_list(List) -> eventify(List); (_) -> erlang:error(badarg) end} end; eventify([Next|Rest]) -> fun() -> {event, Next, eventify(Rest)} end.