style: fix tslint error in switch-layer-action.ts (#666)
This commit is contained in:
committed by
László Monda
parent
82b76a9455
commit
7d81cf0c6a
+32
-32
@@ -14,6 +14,38 @@ export enum SwitchLayerMode {
|
|||||||
hold = 'hold'
|
hold = 'hold'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const mapSwitchLayerModeToNumber = (switchLayerMode: SwitchLayerMode): number => {
|
||||||
|
switch (switchLayerMode) {
|
||||||
|
case SwitchLayerMode.holdAndDoubleTapToggle:
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case SwitchLayerMode.toggle:
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
case SwitchLayerMode.hold:
|
||||||
|
return 2;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new Error(`Can not map ${switchLayerMode} to number`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const mapNumberToSwitchLayerMode = (value: number): SwitchLayerMode => {
|
||||||
|
switch (value) {
|
||||||
|
case 0:
|
||||||
|
return SwitchLayerMode.holdAndDoubleTapToggle;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
return SwitchLayerMode.toggle;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
return SwitchLayerMode.hold;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new Error(`Can not map "${value}" to SwitchLayerMode`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export class SwitchLayerAction extends KeyAction {
|
export class SwitchLayerAction extends KeyAction {
|
||||||
|
|
||||||
@assertEnum(SwitchLayerMode)
|
@assertEnum(SwitchLayerMode)
|
||||||
@@ -75,35 +107,3 @@ export class SwitchLayerAction extends KeyAction {
|
|||||||
return 'SwitchLayerAction';
|
return 'SwitchLayerAction';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const mapSwitchLayerModeToNumber = (switchLayerMode: SwitchLayerMode): number => {
|
|
||||||
switch (switchLayerMode) {
|
|
||||||
case SwitchLayerMode.holdAndDoubleTapToggle:
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
case SwitchLayerMode.toggle:
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
case SwitchLayerMode.hold:
|
|
||||||
return 2;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new Error(`Can not map ${switchLayerMode} to number`);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const mapNumberToSwitchLayerMode = (value: number): SwitchLayerMode => {
|
|
||||||
switch (value) {
|
|
||||||
case 0:
|
|
||||||
return SwitchLayerMode.holdAndDoubleTapToggle;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
return SwitchLayerMode.toggle;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
return SwitchLayerMode.hold;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new Error(`Can not map "${value}" to SwitchLayerMode`);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|||||||
Reference in New Issue
Block a user