Would it be possible to add an option to return the error as a value instead of throwing?
I would rather have a "success" check instead of having a try catch.
eg:
//do this
const qsOptions = {..., safe : true}
let match = qs.qsStrict(qsOptions, qsDefintion, "...");
if (!match.success) { ... }
// instead of this:
try {
let match = qs.qsStrict(qsOptions, qsDefintion, "...");
} catch (error) {
//...
}
try catch makes everything more complex and simply handling a error value is much easier.
it would just be a new parameter in the options type and instead of always throwing, you just check what the safe option is set to.
Doing this would also follow the same conventions of zod.
Would it be possible to add an option to return the error as a value instead of throwing?
I would rather have a "success" check instead of having a try catch.
eg:
try catch makes everything more complex and simply handling a error value is much easier.
it would just be a new parameter in the options type and instead of always throwing, you just check what the
safeoption is set to.Doing this would also follow the same conventions of
zod.