Handle undefined arguments without crashing in skooma

This commit is contained in:
Talia 2022-03-26 12:23:34 +01:00
parent 5f165d1071
commit 0366b3822b
Signed by: darkwiiplayer
GPG key ID: 7808674088232B3E

View file

@ -40,6 +40,8 @@ const parseArgs = (element, before, ...args) => {
for (let arg of args) for (let arg of args)
if (typeof arg == "string" || typeof arg == "number") if (typeof arg == "string" || typeof arg == "number")
element.insertBefore(document.createTextNode(arg), before) element.insertBefore(document.createTextNode(arg), before)
else if (arg === undefined)
console.warn(`Argument is ${typeof arg}`, element)
else if (typeof arg == "function") else if (typeof arg == "function")
arg(element) arg(element)
else if ("nodeName" in arg) else if ("nodeName" in arg)