Environment
I'm working with v4.0.0-alpha.1.
Reproduction
import { VArg } from "ipx/handlers/utils";
// These return undefined instead of the expected string value
VArg("450x300") // undefined (expected: "450x300")
VArg("cover") // undefined (expected: "cover")
VArg("ff0000") // undefined (expected: "ff0000")
// JSON primitives work fine
VArg("123") // 123
VArg("true") // true
Describe the bug
JSON.parse("450x300") throws SyntaxError. The catch block swallows it and the function ends without returning, so undefined is returned implicitly.
export function VArg(argument: string) {
if (argument === "Infinity") {
return Infinity;
}
try {
const val = JSON.parse(argument);
// ...
} catch {
// error swallowed
}
// no return → undefined
}
I'll submit a PR with a fix restoring behavior to what it was before destr was removed 🙌
Additional context
No response
Logs
Environment
I'm working with v4.0.0-alpha.1.
Reproduction
Describe the bug
JSON.parse("450x300")throwsSyntaxError. The catch block swallows it and the function ends without returning, soundefinedis returned implicitly.I'll submit a PR with a fix restoring behavior to what it was before
destrwas removed 🙌Additional context
No response
Logs