21 lines
795 B
TypeScript
21 lines
795 B
TypeScript
const FELICA_MOBILE_OS_VERSIONS = [0x06, 0x07, 0x10, 0x12, 0x13, 0x14, 0x15, 0x17, 0x18] as const;
|
|
const FELICA_CARD_OS_VERSIONS = [0x20, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7] as const;
|
|
|
|
export function IsSupportedFelicaMobile(
|
|
osVer: number
|
|
): osVer is typeof FELICA_MOBILE_OS_VERSIONS[number] {
|
|
return (FELICA_MOBILE_OS_VERSIONS as ReadonlyArray<number>).includes(osVer);
|
|
}
|
|
|
|
export function IsSupportedFelicaCard(
|
|
osVer: number
|
|
): osVer is typeof FELICA_CARD_OS_VERSIONS[number] {
|
|
return (FELICA_CARD_OS_VERSIONS as ReadonlyArray<number>).includes(osVer);
|
|
}
|
|
|
|
export function IsSupportedFelica(
|
|
osVer: number
|
|
): osVer is typeof FELICA_CARD_OS_VERSIONS[number] | typeof FELICA_MOBILE_OS_VERSIONS[number] {
|
|
return IsSupportedFelicaMobile(osVer) || IsSupportedFelicaCard(osVer);
|
|
}
|