UNPKG

zod-opts

Version:

node.js CLI option parser / validator using Zod

23 lines 592 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.number(), }, option2: { type: zod_1.z.number(), }, }) .validation((parsed) => { if (parsed.option1 === parsed.option2) { throw Error("option1 and option2 must be different"); } return true; }) .parse(); console.log(parsed); //# sourceMappingURL=custom_validation.js.map