From 169a06793db8d12b7eeb084d2ebf3f4b108c0d87 Mon Sep 17 00:00:00 2001 From: muxator Date: Tue, 19 Feb 2019 00:15:54 +0100 Subject: [PATCH] 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. --- src/node/db/API.js | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/src/node/db/API.js b/src/node/db/API.js index 21c958809..6d6c8ccff 100644 --- a/src/node/db/API.js +++ b/src/node/db/API.js @@ -126,13 +126,6 @@ Example returns: */ 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 if (rev !== undefined && typeof rev !== "number") { @@ -206,13 +199,6 @@ Example returns: */ 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 if(rev !== undefined && typeof rev != "number") { @@ -347,12 +333,6 @@ Example returns: */ exports.getHTML = function(padID, rev, callback) { - if(typeof rev == "function") - { - callback = rev; - rev = undefined; - } - if (rev !== undefined && typeof rev != "number") { if (isNaN(parseInt(rev))) @@ -623,13 +603,6 @@ Example returns: */ 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 if(rev !== undefined && typeof rev != "number") {