@bookbox/view-html
Version:
Bookbox view for html
23 lines (22 loc) • 537 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.listToHtml = void 0;
/**
* normalize space
*/
const listToHtml = (children) => {
const result = [];
for (const child of children) {
if (/^\s/.test(child)) {
if (result.at(-1) !== ' ') {
result.push(' ');
}
}
result.push(child.trim());
if (/\s$/.test(child)) {
result.push(' ');
}
}
return result.join('');
};
exports.listToHtml = listToHtml;