UNPKG

zod-opts

Version:

node.js CLI option parser / validator using Zod

19 lines 560 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const zod_1 = require("zod"); // import { parser } from "zod-opts"; const index_1 = require("../src/index"); const parsed = (0, index_1.parser)() .options({ option1: { type: zod_1.z.boolean().default(false), alias: "a", }, option2: { type: zod_1.z.string(), }, }) .parse(); // same with .parse(process.argv.slice(2)) // parsed is inferred as { option1: boolean, option2: string } console.log(parsed); //# sourceMappingURL=simple.js.map