utils: append string child directly

Strings can be appended directly without spreading.
pull/2/head
OFF0 2 years ago
parent 380b79038d
commit 5d701c8767
Signed by: offbyn
GPG Key ID: 94A2F643C51F37FA

@ -13,6 +13,10 @@
export function elem(name = 'div', props = {}, children = []) {
const el = document.createElement(name);
Object.assign(el, props);
el.append(...children);
if (typeof children === 'string') {
el.append(children);
} else {
el.append(...children);
}
return el;
}

Loading…
Cancel
Save