1
2
3
4
5
6
7
8
9
10
11
12
import { regionalIndicatorA } from "https://esm.town/v/jdan/regionalIndicatorA";
export const regionalIndicatorOfLetter = (char: string) => {
if (char.length !== 1) {
throw new Error("Must be a single character");
}
if (char < "A" || char > "Z") {
throw new Error("Must be A-Z");
}
return char.charCodeAt(0) - "A".charCodeAt(0) +
regionalIndicatorA;
};