We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
WrappedMaybe['try']
Introduce a try method on WrappedMaybe which called the given fn and if it throws, it returns null.
try
WrappedMaybe
const str: string | null = '...'; const schema = z.object(...); const res = maybe(str)?.try(JSON.parse)?.try(schema.parse)?.take() ?? OTHERWISE;