[Pkg-javascript-commits] [node-mocks-http] 59/296: Resolve subtle lint issues

Thorsten Alteholz alteholz at moszumanska.debian.org
Mon Feb 8 18:13:21 UTC 2016


This is an automated email from the git hooks/post-receive script.

alteholz pushed a commit to branch master
in repository node-mocks-http.

commit 3d04c38a0595a8d9a22cb695201fb15caf632f16
Author: Howard Abrams <howard.abrams at gmail.com>
Date:   Sun Dec 28 21:36:33 2014 -0800

    Resolve subtle lint issues
    
    The body of `if` statements should be surrounded with braces.  Now the
    lint check doesn't stop the build process from executing the tests.
    
    Also, while using `return` to stop `if` execution results in less code,
    I side with the team that favors explicitly using `else` statements.
---
 lib/mockRequest.js | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/lib/mockRequest.js b/lib/mockRequest.js
index 820848b..440b2ad 100644
--- a/lib/mockRequest.js
+++ b/lib/mockRequest.js
@@ -76,16 +76,18 @@ function createRequest(options) {
      *   - req.query
      */
     mockRequest.param = function(parameterName) {
-        if (mockRequest.params[parameterName])
+        if (mockRequest.params[parameterName]) {
             return mockRequest.params[parameterName];
-
-        if (mockRequest.body[parameterName])
+        }
+        else if (mockRequest.body[parameterName]) {
             return mockRequest.body[parameterName];
-
-        if (mockRequest.query[parameterName])
+        }
+        else if (mockRequest.query[parameterName]) {
             return mockRequest.query[parameterName];
-
-        return null;
+        }
+        else {
+            return null;
+        }
     };
 
     /**

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-mocks-http.git



More information about the Pkg-javascript-commits mailing list