📄 Add comments

This commit is contained in:
C-3PO 2018-10-25 07:28:22 +02:00
parent 7a53bfcfbe
commit 60ad737f6f
Signed by: c3po
GPG key ID: 62993C4BB4D86F24

View file

@ -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({
option,
value,
@ -24,7 +28,7 @@ export default function verifyAndStoreOptionValue({
message: IOption['message'],
outputArgs: IState['outputArgs'],
requiredOptions: IState['requiredOptions'],
}) {
}): void {
//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)}`);
if (verifyValue !== true) {