From 69e1bf28aa95e23bebc4cc92868b959a70582cb7 Mon Sep 17 00:00:00 2001 From: muxator Date: Wed, 29 Aug 2018 02:52:26 +0200 Subject: [PATCH] db/Pad: reversed condition to make core logic evident. No functional changes Here it was legal to replace a lax comparison with a strict one, since we are using indexOf(), whose return value is known. --- src/node/db/Pad.js | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/node/db/Pad.js b/src/node/db/Pad.js index f5d65e6ff..66f9aa598 100644 --- a/src/node/db/Pad.js +++ b/src/node/db/Pad.js @@ -620,29 +620,28 @@ Pad.prototype.remove = function remove(callback) { //is it a group pad? -> delete the entry of this pad in the group function(callback) { - //is it a group pad? - if(padID.indexOf("$")!=-1) - { - var groupID = padID.substring(0,padID.indexOf("$")); - - db.get("group:" + groupID, function (err, group) - { - if(ERR(err, callback)) return; - - //remove the pad entry - delete group.pads[padID]; - - //set the new value - db.set("group:" + groupID, group); - - callback(); - }); - } - //its no group pad, nothing to do here - else + if(padID.indexOf("$") === -1) { + // it isn't a group pad, nothing to do here callback(); + return; } + + // it is a group pad + var groupID = padID.substring(0,padID.indexOf("$")); + + db.get("group:" + groupID, function (err, group) + { + if(ERR(err, callback)) return; + + //remove the pad entry + delete group.pads[padID]; + + //set the new value + db.set("group:" + groupID, group); + + callback(); + }); }, //remove the readonly entries function(callback)