function castStringData(input, model) {
    input = input || '';
    var result = '';
    var subtype = model.subtype && model.subtype.type || '';
    // if input has value, keep its value
    if (input) {
      result = input;
    } else {
      switch(subtype) {
        case 'random':
          result = Math.floor(Math.random() * 100000000);
          break;
        case 'uuid':
          result = require('node-uuid').v4().replace(/-/g, '');
          break;
        default:
          result = input;
      }
    }
    return result;
  }
/**
   * To use random or uuid subtype, leave input value as blank
   */
To use random or uuid subtype, leave input value as blank
To use random or uuid subtype leave input value as blank
function castStringData(input, model) {
    input = input || '';
    var result = '';
    var subtype = model.subtype && model.subtype.type || '';
    if (input) {
      result = input;
    } else {
      switch(subtype) {
        case 'random':
          result = Math.floor(Math.random() * 100000000);
          break;
        case 'uuid':
          result = require('node-uuid').v4().replace(/-/g, '');
          break;
        default:
          result = input;
      }
    }
    return result;
  }
function castStringData ( input , model ) { input = input || '' ; var result = '' ; var subtype = model . subtype && model . subtype . type || '' ; if ( input ) { result = input ; } else { switch ( subtype ) { case 'random' : result = Math . floor ( Math . random ( ) * 100000000 ) ; break ; case 'uuid' : result = require ( 'node-uuid' ) . v4 ( ) . replace ( / - / g , '' ) ; break ; default : result = input ; } } return result ; }
To use random or uuid subtype, leave input value as blank
To use random or uuid subtype leave input value as blank
// if input has value, keep its value