db/API.js, SessionManager: lot of copied & pasted code in integer parsing

Replaced with an early return, no functional changes.
This commit is contained in:
muxator 2018-08-29 02:08:05 +02:00
parent 1d45a63864
commit 05a33f1533
2 changed files with 24 additions and 40 deletions

View file

@ -90,15 +90,13 @@ exports.createSession = function(groupID, authorID, validUntil, callback)
if(typeof validUntil != "number")
{
//try to parse the number
if(!isNaN(parseInt(validUntil)))
{
validUntil = parseInt(validUntil);
}
else
if(isNaN(parseInt(validUntil)))
{
callback(new customError("validUntil is not a number","apierror"));
return;
}
validUntil = parseInt(validUntil);
}
//ensure this is not a negativ number