22 lines
731 B
TypeScript
22 lines
731 B
TypeScript
import { FELICA_CARD_IC_TYPES, FELICA_MOBILE_IC_TYPES } from "lib/constants/felica";
|
|
|
|
export type ValidFeliCaIcTypes =
|
|
| typeof FELICA_CARD_IC_TYPES[number]
|
|
| typeof FELICA_MOBILE_IC_TYPES[number];
|
|
|
|
export function IsSupportedFelicaMobile(
|
|
icType: number
|
|
): icType is typeof FELICA_MOBILE_IC_TYPES[number] {
|
|
return (FELICA_MOBILE_IC_TYPES as ReadonlyArray<number>).includes(icType);
|
|
}
|
|
|
|
export function IsSupportedFelicaCard(
|
|
icType: number
|
|
): icType is typeof FELICA_CARD_IC_TYPES[number] {
|
|
return (FELICA_CARD_IC_TYPES as ReadonlyArray<number>).includes(icType);
|
|
}
|
|
|
|
export function IsSupportedFelica(icType: number): icType is ValidFeliCaIcTypes {
|
|
return IsSupportedFelicaMobile(icType) || IsSupportedFelicaCard(icType);
|
|
}
|