Simplify logic to coerce DisplayMode

Summary:
Changelog: [Internal]

TSIA

Reviewed By: ShikaSD

Differential Revision: D28061403

fbshipit-source-id: bb98fa2ccdd3f8e936bec95fbbbeace42664a608
This commit is contained in:
Rubén Norte authored and Facebook GitHub Bot committed 2021-04-30 09:46:14 -07:00
1 parent 6386f691f7
commit fdfadd43f2
1 file changed
+4 -5
+4 -5
View File
@@ -19,15 +19,14 @@ const DisplayMode: {[string]: DisplayModeType} = Object.freeze({
});
export function coerceDisplayMode(value: ?number): DisplayModeType {
if (value == null || value === undefined) {
return DisplayMode.VISIBLE;
}
switch (value) {
case DisplayMode.SUSPENDED:
return DisplayMode.SUSPENDED;
case DisplayMode.HIDDEN:
return value;
return DisplayMode.HIDDEN;
default:
return DisplayMode.VISIBLE;
}
return DisplayMode.VISIBLE;
}
export default DisplayMode;