@jil/args
Version:
A convention based argument parsing and formatting library, with strict validation checks
24 lines • 730 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultValue = void 0;
const constants_1 = require("../constants");
function getDefaultValue(config) {
let value = config.default;
if (value === undefined) {
if (config.multiple) {
value = [];
}
else if (config.type === 'boolean') {
value = constants_1.DEFAULT_BOOLEAN_VALUE;
}
else if (config.type === 'number') {
value = constants_1.DEFAULT_NUMBER_VALUE;
}
else {
value = constants_1.DEFAULT_STRING_VALUE;
}
}
return value;
}
exports.getDefaultValue = getDefaultValue;
//# sourceMappingURL=getDefaultValue.js.map