From ecc54c3b9f16b615e47d95b4f0a5ec6a1afe0ccc Mon Sep 17 00:00:00 2001 From: Gaspar Chilingarov Date: Sun, 12 Nov 2017 00:13:50 +0400 Subject: [PATCH] Fix code style and documentation. --- README.md | 4 +++- c_src/encoder.c | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e291de4..3ff36e8 100644 --- a/README.md +++ b/README.md @@ -95,10 +95,12 @@ Data Format [true, 1.0] -> [true, 1.0] -> [true, 1.0] {[]} -> {} -> {[]} {[{foo, bar}]} -> {"foo": "bar"} -> {[{<<"foo">>, <<"bar">>}]} + {[{123, bar}]} -> {"123": "bar"} -> {[{<<"123">>, <<"bar">>}]} {[{<<"foo">>, <<"bar">>}]} -> {"foo": "bar"} -> {[{<<"foo">>, <<"bar">>}]} #{<<"foo">> => <<"bar">>} -> {"foo": "bar"} -> #{<<"foo">> => <<"bar">>} + #{123 => <<"bar">>} -> {"123": "bar"} -> #{<<"123">> => <<"bar">>} -N.B. The last entry in this table is only valid for VM's that support +N.B. The last two entries in this table are only valid for VM's that support the `maps` data type (i.e., 17.0 and newer) and client code must pass the `return_maps` option to `jiffy:decode/2`. diff --git a/c_src/encoder.c b/c_src/encoder.c index 3ee1f59..0a9ad48 100644 --- a/c_src/encoder.c +++ b/c_src/encoder.c @@ -827,8 +827,7 @@ encode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) ret = enc_error(e, "internal_error"); goto done; } - } - else { + } else { if(!enc_string(e, tuple[0])) { ret = enc_obj_error(e, "invalid_object_member_key", tuple[0]); goto done;