db/PadManager: use jshint

This commit is contained in:
booo 2011-12-22 12:00:04 +01:00
parent ac74ba10d0
commit 928dfcb384

View file

@ -53,14 +53,14 @@ exports.getPad = function(id, text, callback)
}
//make text an optional parameter
if(typeof text == "function")
if(typeof text === "function")
{
callback = text;
text = null;
}
//check if this is a valid text
if(text != null)
if(text)
{
//check if text is a string
if(typeof text != "string")
@ -80,7 +80,7 @@ exports.getPad = function(id, text, callback)
var pad = globalPads.get(id);
//return pad if its already loaded
if(pad != null)
if(pad)
{
callback(null, pad);
}
@ -98,7 +98,7 @@ exports.getPad = function(id, text, callback)
callback(null, pad);
});
}
}
};
//checks if a pad exists
exports.doesPadExists = function(padId, callback)
@ -106,18 +106,18 @@ exports.doesPadExists = function(padId, callback)
db.get("pad:"+padId, function(err, value)
{
if(ERR(err, callback)) return;
callback(null, value != null);
callback(null, value ? true : false);
});
}
};
exports.isValidPadId = function(padId)
{
return /^(g.[a-zA-Z0-9]{16}\$)?[^$]{1,50}$/.test(padId);
}
return (/^(g.[a-zA-Z0-9]{16}\$)?[^$]{1,50}$/).test(padId);
};
//removes a pad from the array
exports.unloadPad = function(padId)
{
if(globalPads.get(padId))
globalPads.remove(padId);
}
};