@jay-js/ui
Version:
A library of UI components for Jay JS with Tailwind CSS and daisyUI.
18 lines (17 loc) • 503 B
JavaScript
export function setChildren(element, children, options = {
clean: true
}) {
if (options === null || options === void 0 ? void 0 : options.deepClean) {
element.childNodes.forEach((child)=>{
element.removeChild(child);
});
}
if (options === null || options === void 0 ? void 0 : options.clean) {
element.innerHTML = "";
}
if (Array.isArray(children)) {
element.append(...children);
} else {
element.append(children);
}
}