generator-begcode
Version:
Spring Boot + Angular/React/Vue in one handy generator
13 lines (12 loc) • 437 B
JavaScript
const isSimpleText = (previousLine, text) => !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;
};