function createElement(tagName, className, ...children) { return createElementInit(tagName, className && (element => element.className = className), ...children); } function createElementInit(tagName, init, ...children) { const element = document.createElement(tagName); if (typeof init === 'function') { init(element); } if (children.length > 0) { element.append(...children); } return element; } export { createElement, createElementInit }