zod-metadata
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "zod-metadata", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Extends Zod with metadata", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -9,6 +9,6 @@ # zod-metadata | ||
## Usage | ||
## Register the Zod extension | ||
### Automatic | ||
Import `zod-metadata/register` the top of your entry files: | ||
Import `zod-metadata/register` at the top of your entry files: | ||
@@ -62,1 +62,20 @@ **JavaScript** | ||
``` | ||
## API | ||
The API provices two methods that will read and write to `schema._def.meta`. | ||
### `schema.meta(meta: Record<string, unknown>): this` | ||
Accumulates metadata mutating the schema: | ||
```javascript | ||
schema | ||
.meta({ key1: value1 }) | ||
.meta({ key2: value2 }); | ||
``` | ||
### `schema.getMeta(): Record<string, unknown>` | ||
Returns the metadata: | ||
```javascript | ||
schema.getMeta(); // => { key1: value1, key2: value2 } | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4944
80