@dark-engine/core
Version:
The lightweight and powerful UI rendering engine without dependencies and written in TypeScript (Browser, Node.js, Android, iOS, Windows, Linux, macOS)
19 lines (18 loc) • 545 B
JavaScript
import { View } from '../view';
import { detectIsString, detectIsFunction } from '../utils';
function createElement(element, props, ...slot) {
if (detectIsString(element)) {
const options = props || {};
options.as = element;
options.slot = slot;
return View(options);
}
if (detectIsFunction(element)) {
const options = props || {};
options.slot = slot.length === 1 ? slot[0] : slot;
return element(options);
}
return null;
}
export { createElement, createElement as h };
//# sourceMappingURL=element.js.map