Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function h (sel, b, c) { // eslint-disable-line complexity
let data = {}
let children
let text
let i
if (arguments.length === 3) {
data = b
if (is.array(c)) {
children = c
} else if (is.primitive(c)) {
text = c
}
} else if (arguments.length === 2) {
if (is.array(b)) {
children = b
} else if (is.primitive(b)) {
text = b
} else {
data = b
}
}
if (is.array(children)) {
children = children.filter(x => x) // handle null/undef children
for (i = 0; i < children.length; ++i) {
if (is.primitive(children[i])) {
children[i] = vnode(undefined, undefined, undefined, children[i])
}
}
}
if (sel[0] === 's' && sel[1] === 'v' && sel[2] === 'g') {
addNS(data, children)
}
export function h (sel, b, c) { // eslint-disable-line complexity
let data = {}
let children
let text
let i
if (arguments.length === 3) {
data = b
if (is.array(c)) {
children = c
} else if (is.primitive(c)) {
text = c
}
} else if (arguments.length === 2) {
if (is.array(b)) {
children = b
} else if (is.primitive(b)) {
text = b
} else {
data = b
}
}
if (is.array(children)) {
children = children.filter(x => x) // handle null/undef children
for (i = 0; i < children.length; ++i) {
if (is.primitive(children[i])) {
children[i] = vnode(undefined, undefined, undefined, children[i])
} else if (is.primitive(c)) {
text = c
}
} else if (arguments.length === 2) {
if (is.array(b)) {
children = b
} else if (is.primitive(b)) {
text = b
} else {
data = b
}
}
if (is.array(children)) {
children = children.filter(x => x) // handle null/undef children
for (i = 0; i < children.length; ++i) {
if (is.primitive(children[i])) {
children[i] = vnode(undefined, undefined, undefined, children[i])
}
}
}
if (sel[0] === 's' && sel[1] === 'v' && sel[2] === 'g') {
addNS(data, children)
}
return vnode(sel, data, children, text, undefined)
};
} else if (is.primitive(c)) {
text = c as string;
}
} else if (arguments.length === 2) {
if (is.array(b)) {
children = b;
} else if (is.primitive(b)) {
text = b as string;
} else {
data = b;
}
}
if (is.array(children)) {
children = children.filter(x => !!x);
for (let i = 0; i < children.length; ++i) {
if (is.primitive(children[i])) {
children[i] = vnode(undefined as any, undefined, undefined, children[i] as any, undefined);
}
}
}
if (sel[0] === 's' && sel[1] === 'v' && sel[2] === 'g') {
addNS(data, children, sel);
}
return vnode(sel, data, children, text, undefined);
};
export function h(sel: string, b?: any, c?: any): VNode {
let data = {};
let children: Array | undefined;
let text: string | undefined;
if (arguments.length === 3) {
data = b;
if (is.array(c)) {
children = c;
} else if (is.primitive(c)) {
text = c as string;
}
} else if (arguments.length === 2) {
if (is.array(b)) {
children = b;
} else if (is.primitive(b)) {
text = b as string;
} else {
data = b;
}
}
if (is.array(children)) {
children = children.filter(x => !!x);
for (let i = 0; i < children.length; ++i) {
if (is.primitive(children[i])) {
children[i] = vnode(undefined as any, undefined, undefined, children[i] as any, undefined);
export function h(sel: string, b?: any, c?: any): VNode {
let data = {};
let children: Array | undefined;
let text: string | undefined;
if (arguments.length === 3) {
data = b;
if (is.array(c)) {
children = c;
} else if (is.primitive(c)) {
text = c as string;
}
} else if (arguments.length === 2) {
if (is.array(b)) {
children = b;
} else if (is.primitive(b)) {
text = b as string;
} else {
data = b;
}
}
if (is.array(children)) {
children = children.filter(x => !!x);
for (let i = 0; i < children.length; ++i) {
if (is.primitive(children[i])) {
children[i] = vnode(undefined as any, undefined, undefined, children[i] as any, undefined);
}
}
}
if (sel[0] === 's' && sel[1] === 'v' && sel[2] === 'g') {
addNS(data, children, sel);
}