Skip to content

Comments

Add tryCatch decoder#637

Open
thewilkybarkid wants to merge 1 commit intogcanti:masterfrom
thewilkybarkid:try-catch
Open

Add tryCatch decoder#637
thewilkybarkid wants to merge 1 commit intogcanti:masterfrom
thewilkybarkid:try-catch

Conversation

@thewilkybarkid
Copy link
Contributor

Helps to create a Decoder from a function that might throw, such as:

const UrlD: D.Decoder<unknown, URL> = pipe(D.string, D.compose(D.tryCatch(value => new URL(value))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant