Introduction
nuxt-parse
is an open source Nuxt 3 focused package to make data validation and parsing easy.
This package follows the design philosophy of the article parse, don't validate.
It uses zod
for parsing data from the user, APIs or your own functions.
- Validate Data using zod
- Deserialize and Serialize user, backend, api data
- Helpers focused on Nuxt 3 usage and developer experience
Show me the code!
nuxt-parse
exports the following functions:
Export | Purpose |
---|---|
parseBodyAs | Parse body of h3 event |
parseParamsAs | Parse params of h3 event |
parseQueryAs | Parse query of h3 event |
parseCookieAs | Parse cookies of h3 event |
parseHeaderAs | Parse header of h3 event |
parseDataAs | Parse sync or async data |
makeParser | Make your own parser (see example here) |
z | zod , the library used for parsing |