Skip to content

Commit 0783808

Browse files
committed
Add usage
1 parent 40ffb39 commit 0783808

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,22 @@ $ npm install @seamapi/url-search-params-parser
5454

5555
[npm]: https://www.npmjs.com/
5656

57+
## Usage
58+
59+
```ts
60+
import { parseUrlSearchParams } from '@seamapi/url-search-params-parser'
61+
62+
parseUrlSearchParams(
63+
'age=27&isAdmin=true&name=Dax&tags=cars&tags=planes',
64+
z.object({
65+
name: z.string().min(1),
66+
age: z.number(),
67+
isAdmin: z.boolean(),
68+
tags: z.array(z.string())
69+
})
70+
) // => { name: 'Dax', age: 27, isAdmin: true, tags: ['cars', 'planes'] }
71+
```
72+
5773
## Development and Testing
5874

5975
### Quickstart

0 commit comments

Comments
 (0)