tasks/autoclass.js
function(array) {

      // Run Functions
      regLoop();

      // Functions
      var addOutputValue = function(objectField, value, property, addon) {
        var index = objectField.unit.indexOf(property),
          indexInDatabase,
          unit;

        if (addon === "responsive") {
          indexInDatabase = checkClassExist(property, responsiveArray);

          if (indexInDatabase === -1) {
            unit = objectField.unit[index + 1];
            responsiveArray.push([property, unit, value]);
            // If array exist
          } else if (responsiveArray[indexInDatabase].indexOf(value) === -1) {
            responsiveArray[indexInDatabase].push(value);
          }

          var typedata = checkType(value);
          if (typedata !== -1) {
            var field = "field" + typedata;
            if (!database[field].output) {
              database[field].output = [];
            }
            // grunt.log.writeln(typedata + " " + field + " " + value);
          }
          return value;

          // if (indexInDatabase === -1) {
          //   console.log("Create new responsive: " + property, unit, value);
          //   unit = objectField.unit[index + 1];
          //   responsiveArray.push([property, unit, value]);
          //   // If array exist
          // } else if (responsiveArray[indexInDatabase].indexOf(value) === -1) {
          //   console.log("Add value to database " + value);
          //   responsiveArray[indexInDatabase].push(value);
          // }
          // console.log("Create new responsive: " + property, unit, value);
          // return value;


        } else {
          indexInDatabase = checkClassExist(property, objectField.output);
          if (indexInDatabase === -1) {
            unit = objectField.unit[index + 1];
            objectField.output.push([property, unit, value]);
            // If array exist
          } else if (objectField.output[indexInDatabase].indexOf(value) === -1) {
            objectField.output[indexInDatabase].push(value);
          }
        }
      };

      var classProcess = function(name) {
        var typedata = checkType(name);
        if (typedata !== -1) {
          var field = "field" + typedata;
          if (!database[field].output) {
            database[field].output = [];
          }

          var checkInField = database[field],
            indexDash = name.indexOf(checkInField.gap),
            property = name.slice(0, indexDash),
            value = name.slice(indexDash + 1, name.length),
            addon = false;

          if (!database[field].output) {
            database[field].output = [];
          }

          // Check if have addon property - "responsive"
          if (database[field].addon === "responsive") {
            addon = addOutputValue(database[field], value, property, "responsive");
          }
          // If don't have addon property
          else {
            addon = addOutputValue(database[field], value, property);
          }

          if (addon) {
            classProcess(addon);
          }

        } else {
          return false;
        }
      };

      // Variables
      var output = [],
        len = array.length;

      // Loop
      for (var i = 0; i < len; i++) {
        classProcess(array[i]);
      }
      return output;
    }
function(array) {

      // Run Functions
      regLoop();

      // Functions
      var addOutputValue = function(objectField, value, property, addon) {
        var index = objectField.unit.indexOf(property),
          indexInDatabase,
          unit;

        if (addon === "responsive") {
          indexInDatabase = checkClassExist(property, responsiveArray);

          if (indexInDatabase === -1) {
            unit = objectField.unit[index + 1];
            responsiveArray.push([property, unit, value]);
            // If array exist
          } else if (responsiveArray[indexInDatabase].indexOf(value) === -1) {
            responsiveArray[indexInDatabase].push(value);
          }

          var typedata = checkType(value);
          if (typedata !== -1) {
            var field = "field" + typedata;
            if (!database[field].output) {
              database[field].output = [];
            }
            // grunt.log.writeln(typedata + " " + field + " " + value);
          }
          return value;

          // if (indexInDatabase === -1) {
          //   console.log("Create new responsive: " + property, unit, value);
          //   unit = objectField.unit[index + 1];
          //   responsiveArray.push([property, unit, value]);
          //   // If array exist
          // } else if (responsiveArray[indexInDatabase].indexOf(value) === -1) {
          //   console.log("Add value to database " + value);
          //   responsiveArray[indexInDatabase].push(value);
          // }
          // console.log("Create new responsive: " + property, unit, value);
          // return value;


        } else {
          indexInDatabase = checkClassExist(property, objectField.output);
          if (indexInDatabase === -1) {
            unit = objectField.unit[index + 1];
            objectField.output.push([property, unit, value]);
            // If array exist
          } else if (objectField.output[indexInDatabase].indexOf(value) === -1) {
            objectField.output[indexInDatabase].push(value);
          }
        }
      };

      var classProcess = function(name) {
        var typedata = checkType(name);
        if (typedata !== -1) {
          var field = "field" + typedata;
          if (!database[field].output) {
            database[field].output = [];
          }

          var checkInField = database[field],
            indexDash = name.indexOf(checkInField.gap),
            property = name.slice(0, indexDash),
            value = name.slice(indexDash + 1, name.length),
            addon = false;

          if (!database[field].output) {
            database[field].output = [];
          }

          // Check if have addon property - "responsive"
          if (database[field].addon === "responsive") {
            addon = addOutputValue(database[field], value, property, "responsive");
          }
          // If don't have addon property
          else {
            addon = addOutputValue(database[field], value, property);
          }

          if (addon) {
            classProcess(addon);
          }

        } else {
          return false;
        }
      };

      // Variables
      var output = [],
        len = array.length;

      // Loop
      for (var i = 0; i < len; i++) {
        classProcess(array[i]);
      }
      return output;
    }
function ( array ) { // Run Functions regLoop ( ) ; // Functions var addOutputValue = function ( objectField , value , property , addon ) { var index = objectField . unit . indexOf ( property ) , indexInDatabase , unit ; if ( addon === "responsive" ) { indexInDatabase = checkClassExist ( property , responsiveArray ) ; if ( indexInDatabase === - 1 ) { unit = objectField . unit [ index + 1 ] ; responsiveArray . push ( [ property , unit , value ] ) ; // If array exist } else if ( responsiveArray [ indexInDatabase ] . indexOf ( value ) === - 1 ) { responsiveArray [ indexInDatabase ] . push ( value ) ; } var typedata = checkType ( value ) ; if ( typedata !== - 1 ) { var field = "field" + typedata ; if ( ! database [ field ] . output ) { database [ field ] . output = [ ] ; } // grunt.log.writeln(typedata + " " + field + " " + value); } return value ; // if (indexInDatabase === -1) { //   console.log("Create new responsive: " + property, unit, value); //   unit = objectField.unit[index + 1]; //   responsiveArray.push([property, unit, value]); //   // If array exist // } else if (responsiveArray[indexInDatabase].indexOf(value) === -1) { //   console.log("Add value to database " + value); //   responsiveArray[indexInDatabase].push(value); // } // console.log("Create new responsive: " + property, unit, value); // return value; } else { indexInDatabase = checkClassExist ( property , objectField . output ) ; if ( indexInDatabase === - 1 ) { unit = objectField . unit [ index + 1 ] ; objectField . output . push ( [ property , unit , value ] ) ; // If array exist } else if ( objectField . output [ indexInDatabase ] . indexOf ( value ) === - 1 ) { objectField . output [ indexInDatabase ] . push ( value ) ; } } } ; var classProcess = function ( name ) { var typedata = checkType ( name ) ; if ( typedata !== - 1 ) { var field = "field" + typedata ; if ( ! database [ field ] . output ) { database [ field ] . output = [ ] ; } var checkInField = database [ field ] , indexDash = name . indexOf ( checkInField . gap ) , property = name . slice ( 0 , indexDash ) , value = name . slice ( indexDash + 1 , name . length ) , addon = false ; if ( ! database [ field ] . output ) { database [ field ] . output = [ ] ; } // Check if have addon property - "responsive" if ( database [ field ] . addon === "responsive" ) { addon = addOutputValue ( database [ field ] , value , property , "responsive" ) ; } // If don't have addon property else { addon = addOutputValue ( database [ field ] , value , property ) ; } if ( addon ) { classProcess ( addon ) ; } } else { return false ; } } ; // Variables var output = [ ] , len = array . length ; // Loop for ( var i = 0 ; i < len ; i ++ ) { classProcess ( array [ i ] ) ; } return output ; }
Return full array with class
Return full array with class