db/API.js: almost removed optional argument handling

The HTTP API doesn't ever omit arguments, it always passes `undefined` for a
parameter that wasn't supplied in the request.

The functions that were simplified are:
  - getRevisionChangeset()
  - getText()
  - getHTML()
  - saveRevision()

The only function still supporting optional arguments is getPadSafe(), which is
only called from this module.
pull/3572/head
muxator 2019-02-19 00:15:54 +01:00
parent 26f3f1bcd0
commit 169a06793d
1 changed files with 0 additions and 27 deletions

View File

@ -126,13 +126,6 @@ Example returns:
*/ */
exports.getRevisionChangeset = function(padID, rev, callback) exports.getRevisionChangeset = function(padID, rev, callback)
{ {
// check if rev is set
if (typeof rev === "function")
{
callback = rev;
rev = undefined;
}
// check if rev is a number // check if rev is a number
if (rev !== undefined && typeof rev !== "number") if (rev !== undefined && typeof rev !== "number")
{ {
@ -206,13 +199,6 @@ Example returns:
*/ */
exports.getText = function(padID, rev, callback) exports.getText = function(padID, rev, callback)
{ {
//check if rev is set
if(typeof rev == "function")
{
callback = rev;
rev = undefined;
}
//check if rev is a number //check if rev is a number
if(rev !== undefined && typeof rev != "number") if(rev !== undefined && typeof rev != "number")
{ {
@ -347,12 +333,6 @@ Example returns:
*/ */
exports.getHTML = function(padID, rev, callback) exports.getHTML = function(padID, rev, callback)
{ {
if(typeof rev == "function")
{
callback = rev;
rev = undefined;
}
if (rev !== undefined && typeof rev != "number") if (rev !== undefined && typeof rev != "number")
{ {
if (isNaN(parseInt(rev))) if (isNaN(parseInt(rev)))
@ -623,13 +603,6 @@ Example returns:
*/ */
exports.saveRevision = function(padID, rev, callback) exports.saveRevision = function(padID, rev, callback)
{ {
//check if rev is set
if(typeof rev == "function")
{
callback = rev;
rev = undefined;
}
//check if rev is a number //check if rev is a number
if(rev !== undefined && typeof rev != "number") if(rev !== undefined && typeof rev != "number")
{ {