add encoder and decoder functions to api

This commit is contained in:
alisdair sullivan 2012-03-04 15:46:41 -08:00
parent 3cbabec80e
commit ed33626ed5
5 changed files with 17 additions and 6 deletions

View file

@ -27,6 +27,7 @@
-export([to_term/1, to_term/2]).
-export([is_json/1, is_json/2]).
-export([format/1, format/2]).
-export([encoder/3, decoder/3]).
%% old api
-export([term_to_json/1, term_to_json/2, json_to_term/1, json_to_term/2]).
@ -79,6 +80,16 @@ is_json(Source) -> is_json(Source, []).
is_json(Source, Opts) -> jsx_verify:is_json(Source, Opts).
-spec decoder(Handler::module(), State::any(), Opts::list()) -> fun().
decoder(Handler, State, Opts) -> jsx_decoder:decoder(Handler, State, Opts).
-spec encoder(Handler::module(), State::any(), Opts::list()) -> fun().
encoder(Handler, State, Opts) -> jsx_encoder:encoder(Handler, State, Opts).
-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").