options for basic image quality control

This commit is contained in:
zadam
2019-11-03 11:43:04 +01:00
parent 9ea8209d4e
commit c9e4261930
4 changed files with 29 additions and 14 deletions

View File

@@ -10,6 +10,18 @@ async function getOption(name) {
return option.value;
}
async function getOptionInt(name) {
const val = await getOption(name);
const intVal = parseInt(val);
if (isNaN(intVal)) {
throw new Error(`Could not parse "${val}" into integer for option "${name}"`);
}
return intVal;
}
async function setOption(name, value) {
const option = await require('./repository').getOption(name);
@@ -51,6 +63,7 @@ async function getOptionsMap(allowedOptions) {
module.exports = {
getOption,
getOptionInt,
setOption,
createOption,
getOptions,