code: function (data, retainEmpty) {
          if (!(Array.isArray(data) && data.length)) { return []; }
  
          var formdata = [],
              i,
              ii,
              param;
  
          for (i = 0, ii = data.length; i < ii; i++) {
              // clone param to avoid mutating data.
              param = typeof data[i] === 'object' && Object.assign({}, data[i]);
  
              // skip if param is missing property `key`,
              // `key` is a required property, value can be null/undefined.
              if (!(param && param.key)) {
                  continue;
              }
  
              // for file `type`, set `value` to `src`
              if (param.type === 'file' && !param.src && param.value) {
                  param.src = (_.isString(param.value) || _.isArray(param.value)) ? param.value : null;
                  delete param.value;
              }
  
              // `hasOwnProperty` check ensures that it don't delete undefined property: `enabled`
              if (Object.prototype.hasOwnProperty.call(param, 'enabled')) {
                  // set `disabled` flag if `enabled` is false.
                  param.enabled === false && (param.disabled = true);
  
                  delete param.enabled; // cleanup
              }
  
              // Prevent empty descriptions from showing up in the converted results. This keeps collections clean.
              util.cleanEmptyValue(param, 'description', retainEmpty);
  
              formdata.push(param);
          }
  
          return formdata;
      }
docs: /* eslint-disable object-shorthand