📄 Add comments
This commit is contained in:
parent
7a53bfcfbe
commit
60ad737f6f
1 changed files with 5 additions and 1 deletions
|
@ -10,6 +10,10 @@ function execWithCustomError(func: (...args: any[]) => any, showError: (error: E
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that the given value is a valid value for this option, and throws an error otherwise.
|
||||||
|
* Also updates state variables if the value is correct.
|
||||||
|
*/
|
||||||
export default function verifyAndStoreOptionValue({
|
export default function verifyAndStoreOptionValue({
|
||||||
option,
|
option,
|
||||||
value,
|
value,
|
||||||
|
@ -24,7 +28,7 @@ export default function verifyAndStoreOptionValue({
|
||||||
message: IOption['message'],
|
message: IOption['message'],
|
||||||
outputArgs: IState['outputArgs'],
|
outputArgs: IState['outputArgs'],
|
||||||
requiredOptions: IState['requiredOptions'],
|
requiredOptions: IState['requiredOptions'],
|
||||||
}) {
|
}): void {
|
||||||
//Verify value for correctness
|
//Verify value for correctness
|
||||||
const verifyValue = execWithCustomError(verify.bind(null, value), (error) => `Invalid value set for option "${option}", the validation of "${value}" failed: ${String(error)}`);
|
const verifyValue = execWithCustomError(verify.bind(null, value), (error) => `Invalid value set for option "${option}", the validation of "${value}" failed: ${String(error)}`);
|
||||||
if (verifyValue !== true) {
|
if (verifyValue !== true) {
|
||||||
|
|
Loading…
Reference in a new issue