mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-05 14:47:12 -04:00
db/PadManager: use jshint
This commit is contained in:
parent
ac74ba10d0
commit
928dfcb384
1 changed files with 19 additions and 19 deletions
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue