zod-opts
Version:
node.js CLI option parser / validator using Zod
19 lines • 599 B
JavaScript
;
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({
opt: {
type: zod_1.z.array(zod_1.z.string()), // required option. 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: {
// opt: string[];
// };
console.log(parsed);
//# sourceMappingURL=array_option.js.map