malevic
Version:
Malevič.js - minimalistic reactive UI library
16 lines (14 loc) • 457 B
JavaScript
/* malevic@0.20.2 - Aug 10, 2024 */
function m(tagOrComponent, props, ...children) {
props = props || {};
if (typeof tagOrComponent === 'string') {
const tag = tagOrComponent;
return { type: tag, props, children };
}
if (typeof tagOrComponent === 'function') {
const component = tagOrComponent;
return { type: component, props, children };
}
throw new Error('Unsupported spec type');
}
export { m };