Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import { parseEnv } from "znv";
import { z } from "zod";

export const { NICKNAME, LLAMA_COUNT, COLOR, SHINY } = parseEnv(process.env, {
NICKNAME: z.string().nonempty(),
NICKNAME: z.string().min(1),
LLAMA_COUNT: z.number().int().positive(),
COLOR: z.enum(["red", "blue"]),
SHINY: z.boolean().default(true),
Expand Down Expand Up @@ -103,7 +103,7 @@ export const { API_SERVER, HOST, PORT, EDITORS, POST_LIMIT, AUTH_SERVER } =

// specs can also be more detailed.
HOST: {
schema: z.string().nonempty(),
schema: z.string().min(1),

// the description is handy as in-code documentation, but is also printed
// to the console if validation for this env var fails.
Expand All @@ -128,7 +128,7 @@ export const { API_SERVER, HOST, PORT, EDITORS, POST_LIMIT, AUTH_SERVER } =

// using a zod `array()` or `object()` as a spec will make znv attempt to
// `JSON.parse` the env var if it's present.
EDITORS: z.array(z.string().nonempty()),
EDITORS: z.array(z.string().min(1)),

// optional values are also supported and provide a way to benefit from the
// validation and static typing provided by zod even if you don't want to
Expand Down Expand Up @@ -233,7 +233,7 @@ pass a `DetailedSpec` object that has the following fields:
```ts
const schemas = {
FRUIT: {
schema: z.string().nonempty(),
schema: z.string().min(1),
defaults: {
production: "orange",
development: "banana",
Expand Down