LearnPAd/learnpad

View on GitHub
lp-simulation-environment/simulator/src/main/resources/static/lib/jsonform-defaults.js

Summary

Maintainability
C
1 day
Test Coverage

Function setDefaultValues has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var setDefaultValues = function (obj, schema, includeOptionalValues, skipFieldsWithoutDefaultValue) {
    if (!obj || !schema) return obj;
    if (!schema.properties) {
      schema = { properties: schema };
    }

    Function setObjKey has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var setObjKey = function (obj, key, value) {
        var keyparts = key.split('.');
    
        // Recursive version of setObjKey
        var recSetObjKey = function (obj, keyparts, value) {

      Function recSetObjKey has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var recSetObjKey = function (obj, keyparts, value) {
            var arrayMatch = null;
            var reArray = /\[([0-9]*)\]$/;
            var subkey = keyparts.shift();
            var idx = 0;

        Function extractDefaultValues has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            var extractDefaultValues = function (schemaItem, path) {
              var properties = null;
              var child = null;
        
              if (!schemaItem || (schemaItem !== Object(schemaItem))) return null;

          There are no issues that match your filters.

          Category
          Status