UNPKG

zod-opts

Version:

node.js CLI option parser / validator using Zod

20 lines 611 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)() .args([ { name: "pos", type: zod_1.z.array(zod_1.z.string()), // required arg. type is string[] // type: z.array(z.string()).default([]), // optional arg. type is string[] and default is [] }, ]) .parse(); // parsed is inferred as below: // const parsed: { // pos: string[]; // }; console.log(parsed); //# sourceMappingURL=array_argument.js.map