generator-begcode
Version:
Spring Boot + Angular/React/Vue in one handy generator
15 lines (14 loc) • 453 B
JavaScript
const isSimpleText = (previousLine, text) => {
return !previousLine.endsWith('>') && !text.startsWith('<');
};
export const formatDocAsSingleLine = (text) => {
let [description, ...rows] = text.split('\n');
rows = rows.map(row => row.trim()).filter(row => row);
for (const row of rows) {
if (isSimpleText(description, row)) {
description += ' ';
}
description += row;
}
return description;
};