Proposal to Add a `CapturePattern` Function to the `Schema` Module for Type-Safe String Decoding

Hi all, I ran into some limitations with the TemplateLiteralParser . As a workaround, I wrote function (CapturePattern) that takes a regex and a Schema<A, I extends Record<string, string>, and returns a transform schema transforming from a String to the provided schema, decoding the subpattern matches of the named capturing groups within the provided regex. I think it's working well, and provides some nice type-safe string decoding without having to transcode between the Tuple decoded by the TemplateLiteralParser and the desired output schema. Would there be any interest in adding this function to the Schema module exports? If so, I'll create a PR!
Was this page helpful?