UNPKG

clefairy

Version:

Typed CLI argv parser and main function wrapper

25 lines (24 loc) 862 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getHints = getHints; const clef_parse_1 = require("clef-parse"); const symbols_1 = require("./symbols"); function getHints(argsObject) { const hints = {}; for (const [key, value] of Object.entries(argsObject)) { const hintValue = { [symbols_1.requiredString]: String, [symbols_1.requiredNumber]: Number, [symbols_1.requiredBoolean]: Boolean, [symbols_1.requiredPath]: clef_parse_1.Path, [symbols_1.optionalString]: String, [symbols_1.optionalNumber]: Number, [symbols_1.optionalBoolean]: Boolean, [symbols_1.optionalPath]: clef_parse_1.Path, }[value]; if (hintValue != null) { hints[key] = hintValue; } } return hints; }