import JDLField from '../../models/jdl-field.js';
import { formatComment } from '../../utils/format-utils.js';
import { lowerFirst } from '../../utils/string-utils.js';
export default { convertField };
export function convertField(field) {
    if (!field) {
        throw new Error('A field has to be passed so as to be converted.');
    }
    const name = lowerFirst(field.name);
    const jdlField = new JDLField({
        name,
        type: field.type,
    });
    if (field.documentation) {
        jdlField.comment = formatComment(field.documentation);
    }
    return jdlField;
}
