lib/formatTools.js
function getFieldsForModelTemplate(fields) {
    var lg = fields.length - 1;

    var modelFields = '{' + os.EOL;
    fields.forEach(function(field, index, array) {
        modelFields += '\t\'' + field.name + '\' : '+ (field.isArray ? '[' : '') + (allowedFieldsTypes[field.type]).name + (field.isArray ? ']' : '');
        modelFields += (lg > index) ? ',' + os.EOL : os.EOL;

        if (field.reference) {
            modelFields = modelFields.replace(/{ref}/, field.reference);
        }
    });
    modelFields += '}';

    return modelFields;
}
function getFieldsForModelTemplate(fields) {
    var lg = fields.length - 1;

    var modelFields = '{' + os.EOL;
    fields.forEach(function(field, index, array) {
        modelFields += '\t\'' + field.name + '\' : '+ (field.isArray ? '[' : '') + (allowedFieldsTypes[field.type]).name + (field.isArray ? ']' : '');
        modelFields += (lg > index) ? ',' + os.EOL : os.EOL;

        if (field.reference) {
            modelFields = modelFields.replace(/{ref}/, field.reference);
        }
    });
    modelFields += '}';

    return modelFields;
}
function getFieldsForModelTemplate ( fields ) { var lg = fields . length - 1 ; var modelFields = '{' + os . EOL ; fields . forEach ( function ( field , index , array ) { modelFields += '\t\'' + field . name + '\' : ' + ( field . isArray ? '[' : '' ) + ( allowedFieldsTypes [ field . type ] ) . name + ( field . isArray ? ']' : '' ) ; modelFields += ( lg > index ) ? ',' + os . EOL : os . EOL ; if ( field . reference ) { modelFields = modelFields . replace ( / {ref} / , field . reference ) ; } } ) ; modelFields += '}' ; return modelFields ; }
Format the fields for the model template
@param {array} fields fields input
@returns {string} formatted fields
Format the fields for the model template