lib/util.js

Summary

Maintainability
F
1 wk
Test Coverage

File util.js has 998 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// utility functions

// first check if moment.js is already loaded in the browser window, if so,
// use this instance. Else, load via commonjs.

Severity: Major
Found in lib/util.js - About 2 days to fix

    Function convert has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
    Open

    exports.convert = function (object, type) {
      var match;
    
      if (object === undefined) {
        return undefined;
    Severity: Minor
    Found in lib/util.js - About 7 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function convert has 125 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.convert = function (object, type) {
      var match;
    
      if (object === undefined) {
        return undefined;
    Severity: Major
    Found in lib/util.js - About 5 hrs to fix

      Function mergeOptions has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.mergeOptions = function (mergeTarget, options, option, globalOptions = {}) {
        // Local helpers
        var isPresent = function(obj) {
          return obj !== null && obj !== undefined;
        }
      Severity: Minor
      Found in lib/util.js - About 4 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function deepExtend has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.deepExtend = function (a, b, protoExtend=false, allowDeletion=false) {
        for (var prop in b) {
          if (b.hasOwnProperty(prop) || protoExtend === true) {
            if (b[prop] && b[prop].constructor === Object) {
              if (a[prop] === undefined) {
      Severity: Minor
      Found in lib/util.js - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function parseColor has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.parseColor = function (color) {
        var c;
        if (exports.isString(color) === true) {
          if (exports.isValidRGB(color) === true) {
            var rgb = color.substr(4).substr(0, color.length - 5).split(',').map(function (value) { return parseInt(value) });
      Severity: Minor
      Found in lib/util.js - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function selectiveNotDeepExtend has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.selectiveNotDeepExtend = function (propsToExclude, a, b, allowDeletion = false) {
        // TODO: add support for Arrays to deepExtend
        // NOTE: array properties have an else-below; apparently, there is a problem here. 
        if (Array.isArray(b)) {
          throw new TypeError('Arrays are not supported by deepExtend');
      Severity: Minor
      Found in lib/util.js - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function parseColor has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.parseColor = function (color) {
        var c;
        if (exports.isString(color) === true) {
          if (exports.isValidRGB(color) === true) {
            var rgb = color.substr(4).substr(0, color.length - 5).split(',').map(function (value) { return parseInt(value) });
      Severity: Major
      Found in lib/util.js - About 2 hrs to fix

        Function mergeOptions has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.mergeOptions = function (mergeTarget, options, option, globalOptions = {}) {
          // Local helpers
          var isPresent = function(obj) {
            return obj !== null && obj !== undefined;
          }
        Severity: Major
        Found in lib/util.js - About 2 hrs to fix

          Function selectiveDeepExtend has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.selectiveDeepExtend = function (props, a, b, allowDeletion = false) {
            // TODO: add support for Arrays to deepExtend
            if (Array.isArray(b)) {
              throw new TypeError('Arrays are not supported by deepExtend');
            }
          Severity: Minor
          Found in lib/util.js - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function binarySearchValue has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.binarySearchValue = function (orderedItems, target, field, sidePreference, comparator) {
            var maxIterations = 10000;
            var iteration = 0;
            var low = 0;
            var high = orderedItems.length - 1;
          Severity: Minor
          Found in lib/util.js - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function getType has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.getType = function (object) {
            var type = typeof object;
          
            if (type == 'object') {
              if (object === null) {
          Severity: Minor
          Found in lib/util.js - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function bridgeObject has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.bridgeObject = function (referenceObject) {
            if (referenceObject !== null && typeof referenceObject === "object") {  // !!! typeof null === 'object'
              var objectTo = Object.create(referenceObject);
              if (referenceObject instanceof Element) {
                // Avoid bridging DOM objects
          Severity: Minor
          Found in lib/util.js - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function topMost has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.topMost = function (pile, accessors) {
            let candidate;
            if (!Array.isArray(accessors)) {
              accessors = [accessors];
            }
          Severity: Minor
          Found in lib/util.js - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function fillIfDefined has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.fillIfDefined = function (a, b, allowDeletion = false) {
            // NOTE: iteration of properties of a
            // NOTE: prototype properties iterated over as well
            for (var prop in a) {
              if (b[prop] !== undefined) {
          Severity: Minor
          Found in lib/util.js - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function selectiveBridgeObject has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.selectiveBridgeObject = function (fields, referenceObject) {
            if (referenceObject !== null && typeof referenceObject === "object") {  // !!! typeof null === 'object'
              var objectTo = Object.create(referenceObject);
              for (var i = 0; i < fields.length; i++) {
                if (referenceObject.hasOwnProperty(fields[i])) {
          Severity: Minor
          Found in lib/util.js - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function getType has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.getType = function (object) {
            var type = typeof object;
          
            if (type == 'object') {
              if (object === null) {
          Severity: Minor
          Found in lib/util.js - About 1 hr to fix

            Function binarySearchValue has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.binarySearchValue = function (orderedItems, target, field, sidePreference, comparator) {
              var maxIterations = 10000;
              var iteration = 0;
              var low = 0;
              var high = orderedItems.length - 1;
            Severity: Minor
            Found in lib/util.js - About 1 hr to fix

              Function selectiveNotDeepExtend has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports.selectiveNotDeepExtend = function (propsToExclude, a, b, allowDeletion = false) {
                // TODO: add support for Arrays to deepExtend
                // NOTE: array properties have an else-below; apparently, there is a problem here. 
                if (Array.isArray(b)) {
                  throw new TypeError('Arrays are not supported by deepExtend');
              Severity: Minor
              Found in lib/util.js - About 1 hr to fix

                Function forEach has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                exports.forEach = function (object, callback) {
                  var i,
                    len;
                  if (Array.isArray(object)) {
                    // array
                Severity: Minor
                Found in lib/util.js - About 55 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Avoid deeply nested control flow statements.
                Open

                          if (typeof referenceObject[i] == "object") {
                            objectTo[i] = exports.bridgeObject(referenceObject[i]);
                          }
                Severity: Major
                Found in lib/util.js - About 45 mins to fix

                  Function selectiveExtend has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  exports.selectiveExtend = function (props, a, b) {  // eslint-disable-line no-unused-vars
                    if (!Array.isArray(props)) {
                      throw new Error('Array with property names expected as first argument');
                    }
                  
                  
                  Severity: Minor
                  Found in lib/util.js - About 45 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Avoid deeply nested control flow statements.
                  Open

                          for (let i = 0; i < b[prop].length; i++) {
                            a[prop].push(b[prop][i]);
                          }
                  Severity: Major
                  Found in lib/util.js - About 45 mins to fix

                    Function binarySearchValue has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    exports.binarySearchValue = function (orderedItems, target, field, sidePreference, comparator) {
                    Severity: Minor
                    Found in lib/util.js - About 35 mins to fix

                      Function binarySearchCustom has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      exports.binarySearchCustom = function (orderedItems, comparator, field, field2) {
                        var maxIterations = 10000;
                        var iteration = 0;
                        var low = 0;
                        var high = orderedItems.length - 1;
                      Severity: Minor
                      Found in lib/util.js - About 35 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function RGBToHSV has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      exports.RGBToHSV = function (red, green, blue) {
                        red = red / 255; green = green / 255; blue = blue / 255;
                        var minRGB = Math.min(red, Math.min(green, blue));
                        var maxRGB = Math.max(red, Math.max(green, blue));
                      
                      
                      Severity: Minor
                      Found in lib/util.js - About 35 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Avoid too many return statements within this function.
                      Open

                            return 'Array';
                      Severity: Major
                      Found in lib/util.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return '/Date(' + object + ')/';
                        Severity: Major
                        Found in lib/util.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return moment(object);
                          Severity: Major
                          Found in lib/util.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return moment(object.valueOf());
                            Severity: Major
                            Found in lib/util.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                        return moment(object); // parse string
                              Severity: Major
                              Found in lib/util.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                    return 'Number';
                                Severity: Major
                                Found in lib/util.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                    return type;
                                  Severity: Major
                                  Found in lib/util.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                            return new Date(object);
                                    Severity: Major
                                    Found in lib/util.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                              return object.toISOString();
                                      Severity: Major
                                      Found in lib/util.js - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                return '/Date(' + value + ')/';
                                        Severity: Major
                                        Found in lib/util.js - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                    return moment(new Date(object)).toDate(); // parse string
                                          Severity: Major
                                          Found in lib/util.js - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                      return moment(Number(match[1])); // parse number
                                            Severity: Major
                                            Found in lib/util.js - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                  return 'Object';
                                              Severity: Major
                                              Found in lib/util.js - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                        return new Date(object.valueOf());
                                                Severity: Major
                                                Found in lib/util.js - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                            return moment(object).format(); // ISO 8601
                                                  Severity: Major
                                                  Found in lib/util.js - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                            return '/Date(' + object.valueOf() + ')/';
                                                    Severity: Major
                                                    Found in lib/util.js - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                              return moment(object);
                                                      Severity: Major
                                                      Found in lib/util.js - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                return new Date(object);
                                                        Severity: Major
                                                        Found in lib/util.js - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                                  return Number(object.valueOf());
                                                          Severity: Major
                                                          Found in lib/util.js - About 30 mins to fix

                                                            Avoid too many return statements within this function.
                                                            Open

                                                                  return 'Date';
                                                            Severity: Major
                                                            Found in lib/util.js - About 30 mins to fix

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                  return 'Boolean';
                                                              Severity: Major
                                                              Found in lib/util.js - About 30 mins to fix

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                    return 'undefined';
                                                                Severity: Major
                                                                Found in lib/util.js - About 30 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                            return new Date(Number(match[1])); // parse number
                                                                  Severity: Major
                                                                  Found in lib/util.js - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                        return 'String';
                                                                    Severity: Major
                                                                    Found in lib/util.js - About 30 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                              return new Date(object.valueOf());
                                                                      Severity: Major
                                                                      Found in lib/util.js - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                                return object.toDate().toISOString();
                                                                        Severity: Major
                                                                        Found in lib/util.js - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                                    return new Date(Number(match[1])).toISOString(); // parse number
                                                                          Severity: Major
                                                                          Found in lib/util.js - About 30 mins to fix

                                                                            Function overrideOpacity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                            exports.overrideOpacity = function (color, opacity) {
                                                                              var rgb;
                                                                              if (color.indexOf("rgba") != -1) {
                                                                                return color;
                                                                              }
                                                                            Severity: Minor
                                                                            Found in lib/util.js - About 25 mins to fix

                                                                            Cognitive Complexity

                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                            Further reading

                                                                            Function removeEventListener has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                            exports.removeEventListener = function (element, action, listener, useCapture) {
                                                                              if (element.removeEventListener) {
                                                                                // non-IE browsers
                                                                                if (useCapture === undefined)
                                                                                  useCapture = false;
                                                                            Severity: Minor
                                                                            Found in lib/util.js - About 25 mins to fix

                                                                            Cognitive Complexity

                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                            Further reading

                                                                            Function assignAllKeys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                            exports.assignAllKeys = function (obj, value) {
                                                                              for (var prop in obj) {
                                                                                if (obj.hasOwnProperty(prop)) {
                                                                                  if (typeof obj[prop] !== 'object') {
                                                                                    obj[prop] = value;
                                                                            Severity: Minor
                                                                            Found in lib/util.js - About 25 mins to fix

                                                                            Cognitive Complexity

                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                            Further reading

                                                                            Function extend has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                            exports.extend = function (a, b) {  // eslint-disable-line no-unused-vars
                                                                              for (var i = 1; i < arguments.length; i++) {
                                                                                var other = arguments[i];
                                                                                for (var prop in other) {
                                                                                  if (other.hasOwnProperty(prop)) {
                                                                            Severity: Minor
                                                                            Found in lib/util.js - About 25 mins to fix

                                                                            Cognitive Complexity

                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                            Further reading

                                                                            Function addEventListener has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                            exports.addEventListener = function (element, action, listener, useCapture) {
                                                                              if (element.addEventListener) {
                                                                                if (useCapture === undefined)
                                                                                  useCapture = false;
                                                                            
                                                                            
                                                                            Severity: Minor
                                                                            Found in lib/util.js - About 25 mins to fix

                                                                            Cognitive Complexity

                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                            Further reading

                                                                            TODO found
                                                                            Open

                                                                              // TODO: add support for Arrays to deepExtend
                                                                            Severity: Minor
                                                                            Found in lib/util.js by fixme

                                                                            TODO found
                                                                            Open

                                                                              // TODO: add support for Arrays to deepExtend
                                                                            Severity: Minor
                                                                            Found in lib/util.js by fixme

                                                                            There are no issues that match your filters.

                                                                            Category
                                                                            Status