habits-cli
Version:
The habits application seeks to help individuals build up healthy habits.
21 lines (20 loc) • 613 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.argParser = void 0;
var commander_1 = require("commander");
var utils_1 = require("../../utils");
var argParser = function (schema) {
return function (value) {
if (typeof value === "string" && !value) {
return null;
}
try {
schema.validateSync(value);
}
catch (error) {
throw new commander_1.InvalidArgumentError(utils_1.stringParser.capitalize(error.message));
}
return schema.cast(value);
};
};
exports.argParser = argParser;