malevic
Version:
Malevič.js - minimalistic reactive UI library
28 lines (24 loc) • 1.02 kB
JavaScript
/* malevic@0.20.2 - Aug 10, 2024 */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Malevic = {}));
})(this, (function (exports) { 'use strict';
function m(tagOrComponent, props) {
var children = [];
for (var _i = 2; _i < arguments.length; _i++) {
children[_i - 2] = arguments[_i];
}
props = props || {};
if (typeof tagOrComponent === 'string') {
var tag = tagOrComponent;
return { type: tag, props: props, children: children };
}
if (typeof tagOrComponent === 'function') {
var component = tagOrComponent;
return { type: component, props: props, children: children };
}
throw new Error('Unsupported spec type');
}
exports.m = m;
}));