diff options
Diffstat (limited to 'src/couchdb/couch_util.erl')
-rw-r--r-- | src/couchdb/couch_util.erl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/couchdb/couch_util.erl b/src/couchdb/couch_util.erl index 7efc07c0..cdae0d4a 100644 --- a/src/couchdb/couch_util.erl +++ b/src/couchdb/couch_util.erl @@ -19,7 +19,7 @@ -export([encodeBase64/1, decodeBase64/1, encodeBase64Url/1, decodeBase64Url/1, to_hex/1,parse_term/1, dict_find/3]). -export([file_read_size/1, get_nested_json_value/2, json_user_ctx/1]). --export([to_binary/1, to_list/1, url_encode/1]). +-export([to_binary/1, to_integer/1, to_list/1, url_encode/1]). -include("couch_db.hrl"). -include_lib("kernel/include/file.hrl"). @@ -371,6 +371,13 @@ to_binary(V) when is_atom(V) -> to_binary(V) -> list_to_binary(io_lib:format("~p", [V])). +to_integer(V) when is_integer(V) -> + V; +to_integer(V) when is_list(V) -> + erlang:list_to_integer(V); +to_integer(V) when is_binary(V) -> + erlang:list_to_integer(binary_to_list(V)). + to_list(V) when is_list(V) -> V; to_list(V) when is_binary(V) -> |