Add option to disable spellcheck

Add input-validator and tests
This commit is contained in:
Afzal Najam
2021-02-24 12:50:39 -05:00
committed by Yang
parent a732f125bb
commit 84b9418977
9 changed files with 71 additions and 9 deletions
+11 -1
View File
@@ -24,13 +24,23 @@ export function checkArch(arch: string): void {
}
export function checkDisableAnimations(disableAnimations: string): void {
if (disableAnimations !== 'true' && disableAnimations !== 'false') {
if (!isValidBoolean(disableAnimations)) {
throw new Error(`Input for input.disable-animations should be either 'true' or 'false'.`);
}
}
export function checkDisableSpellchecker(disableSpellchecker: string): void {
if (!isValidBoolean(disableSpellchecker)) {
throw new Error(`Input for input.disable-spellchecker should be either 'true' or 'false'.`);
}
}
export function checkEmulatorBuild(emulatorBuild: string): void {
if (isNaN(Number(emulatorBuild)) || !Number.isInteger(Number(emulatorBuild))) {
throw new Error(`Unexpected emulator build: '${emulatorBuild}'.`);
}
}
function isValidBoolean(value: string): boolean {
return value === 'true' || value === 'false';
}