mirror of
https://github.com/frappe/books.git
synced 2024-11-13 00:46:28 +00:00
76c61a5c29
- make converter more explicit
18 lines
457 B
TypeScript
18 lines
457 B
TypeScript
import countryInfo from 'fixtures/countryInfo.json';
|
|
import { CountryInfoMap } from './types';
|
|
|
|
export function getCountryInfo(): CountryInfoMap {
|
|
// @ts-ignore
|
|
return countryInfo as CountryInfoMap;
|
|
}
|
|
|
|
export function getCountryCodeFromCountry(countryName: string): string {
|
|
const countryInfoMap = getCountryInfo();
|
|
const countryInfo = countryInfoMap[countryName];
|
|
if (countryInfo === undefined) {
|
|
return '';
|
|
}
|
|
|
|
return countryInfo.code;
|
|
}
|