diff options
Diffstat (limited to 'apps/couch/src/couch_util.erl')
-rw-r--r-- | apps/couch/src/couch_util.erl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/couch/src/couch_util.erl b/apps/couch/src/couch_util.erl index 839f5956..6e483730 100644 --- a/apps/couch/src/couch_util.erl +++ b/apps/couch/src/couch_util.erl @@ -17,7 +17,7 @@ -export([rand32/0, implode/2, collate/2, collate/3]). -export([abs_pathname/1,abs_pathname/2, trim/1]). -export([encodeBase64Url/1, decodeBase64Url/1]). --export([validate_utf8/1, to_hex/1, parse_term/1, dict_find/3]). +-export([validate_utf8/1, to_hex/1, from_hex/1, parse_term/1, dict_find/3]). -export([get_nested_json_value/2, json_user_ctx/1]). -export([proplist_apply_field/2, json_apply_field/2]). -export([to_binary/1, to_integer/1, to_list/1, url_encode/1]). @@ -148,6 +148,11 @@ to_hex([H|T]) -> to_digit(N) when N < 10 -> $0 + N; to_digit(N) -> $a + N-10. +from_hex(Hex) when is_binary(Hex) -> + mochihex:to_bin(?b2l(Hex)); +from_hex(Hex) when is_list(Hex) -> + mochihex:to_bin(Hex). + parse_term(Bin) when is_binary(Bin) -> parse_term(binary_to_list(Bin)); |