From e480e299438a60c624bf34104407d7227a4375e3 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 17 Nov 2015 08:29:45 +0000 Subject: [PATCH] overload upsert (id, data) --- lib/dbwrap.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/dbwrap.js b/lib/dbwrap.js index c7ab8da..abf9a2e 100644 --- a/lib/dbwrap.js +++ b/lib/dbwrap.js @@ -149,6 +149,11 @@ function wrap(db, dir) { }; DB.upsert = function (id, data) { + if (!data) { + data = id; + id = data[idnameCased]; + } + return DB.set(id, data).then(function (result) { var success = result.changes >= 1; @@ -179,7 +184,6 @@ function wrap(db, dir) { } else { //console.log('[debug result of set]', result.sql); delete result.sql; - console.log(result); } return null;