Sean Wilkinson avatar Sean Wilkinson committed 4854852

Converted some `switch..case` statements to `if..else if` to appease JSLint

Comments (0)

Files changed (2)

src/browser-client/main.js

 //      https://bugzilla.mozilla.org/show_bug.cgi?id=756028
 //
 //                                                      ~~ (c) SRW, 23 May 2012
-//                                                  ~~ last updated 05 Dec 2013
+//                                                  ~~ last updated 17 Dec 2013
 
 (function () {
     'use strict';
     detect = function (feature_name) {
      // This function is a high-level feature detection abstraction that helps
      // make the rest of the program logic read like English.
-        switch (feature_name) {
-        case 'console.error':
-            return ((window.hasOwnProperty('console')) &&
+        var flag = false;
+        if (feature_name === 'console.error') {
+            flag = ((window.hasOwnProperty('console')) &&
                     (is_Function(window.console.error)));
-        case 'console.log':
-            return ((window.hasOwnProperty('console')) &&
+        } else if (feature_name === 'console.log') {
+            flag = ((window.hasOwnProperty('console')) &&
                     (is_Function(window.console.log)));
-        case 'localStorage':
+        } else if (feature_name === 'localStorage') {
          // HTML5 localStorage object
-            return (window.localStorage instanceof Object);
-        default:
-         // (placeholder)
+            flag = (window.localStorage instanceof Object);
         }
-        return false;
+        return flag;
     };
 
     get_data = function (callback) {

src/browser-client/qmachine.js

 
 //- qmachine.js ~~
 //                                                      ~~ (c) SRW, 15 Nov 2012
-//                                                  ~~ last updated 06 Nov 2013
+//                                                  ~~ last updated 17 Dec 2013
 
 (function (global, sandbox) {
     'use strict';
                 params = (params instanceof Object) ? params : {};
                 ply(params).by(function (key, val) {
                  // This has a "forEach" pattern ==> `ply` is justified.
-                    switch (key) {
-                    case 'get':
+                    if (key === 'get') {
                         obj.__defineGetter__(name, val);
-                        break;
-                    case 'set':
+                    } else if (key === 'set') {
                         obj.__defineSetter__(name, val);
-                        break;
-                    case 'value':
-                     // NOTE: This may fail if the property's "configurable"
+                    } else if (key === 'value') {
+                     // NOTE: This may fail if the property's `configurable`
                      // attribute was set to `false`, but if such an error
                      // could occur, that JS implementation would have had a
                      // native `Object.defineProperty` method anyway :-P
                         delete obj[name];
                         obj[name] = val;
-                        break;
-                    default:
-                     // (placeholder)
                     }
                     return;
                 });
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.