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.
This commit is contained in:
parent
d931a700b4
commit
69e1bf28aa
1 changed files with 19 additions and 20 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue