Skip to content

Commit

Permalink
Allow couchbeam_doc:extend/2 to merge 2 documents.
Browse files Browse the repository at this point in the history
  • Loading branch information
JonGretar committed Jan 29, 2013
1 parent a9aeafc commit b45b3c9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/couchbeam_doc.erl
Expand Up @@ -81,9 +81,11 @@ extend(Key, Value, JsonObj) ->

%% @spec extend(Prop::property(), JsonObj::json_obj()) -> json_obj()
%% @type property() = json_obj() | tuple()
%% @doc extend a jsonobject by a property or list of property
%% @doc extend a jsonobject by a property, list of property or another jsonobject
extend([], JsonObj) ->
JsonObj;
extend({List}, JsonObj) when is_list(List) ->
extend(List, JsonObj);
extend([Prop|R], JsonObj)->
NewObj = extend(Prop, JsonObj),
extend(R, NewObj);
Expand Down

0 comments on commit b45b3c9

Please sign in to comment.