UNPKG

generator-begcode

Version:

Spring Boot + Angular/React/Vue in one handy generator

19 lines (18 loc) 588 B
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; }