1. Sean Wilkinson
  2. qmachine

Commits

Sean Wilkinson  committed 4854852

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

  • Participants
  • Parent commits 927708e
  • Branches master

Comments (0)

Files changed (2)

File src/browser-client/main.js

View file
  • Ignore whitespace
 //      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) {

File src/browser-client/qmachine.js

View file
  • Ignore whitespace
 
 //- 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;
                 });