This is my first ever public library, I'd be glad for any comments/suggestions of any kind. GitHub: https://github.com/theboxer/zod-search-params
I'm a big fan of persisting parts of an app's state (usually filters, pagination and sort) in the URL params, since it's easier to share specific state of an app with others and provides out of the box persistence across reloads.
But working with URL params in JS/TS is kind of weird, there's no built in type safety, or default values. I decided to give it a shot and create a library, utilising zod's schema validation, that solves those problems.
It converts URL params to desired types, provides a default value (if specified & desired) and correctly type the output.
Thanks!