UNPKG

hyperapp

Version:

1 KB JavaScript library for building frontend applications.

33 lines (28 loc) 628 B
var i var stack = [] export function h(tag, data) { var node var children = [] for (i = arguments.length; i-- > 2; ) { stack.push(arguments[i]) } while (stack.length) { if (Array.isArray((node = stack.pop()))) { for (i = node.length; i--; ) { stack.push(node[i]) } } else if (node != null && node !== true && node !== false) { if (typeof node === "number") { node = node + "" } children.push(node) } } return typeof tag === "string" ? { tag: tag, data: data || {}, children: children } : tag(data, children) }