Update update-readme.ts

This commit is contained in:
Aleksandr Statciuk 2021-11-10 15:07:38 +03:00
parent bec64c128d
commit 43876826c1

View file

@ -68,13 +68,7 @@ async function main() {
emptyGuides emptyGuides
} }
if (!code.includes('-')) { if (code.startsWith('us-')) {
const country: Country | undefined = countries[code]
if (!country) return
guide.flag = country.flag
guide.name = country.name
guidesByCountry.push(guide)
} else if (code.startsWith('us-')) {
const [_, stateCode] = code.split('-') const [_, stateCode] = code.split('-')
const state: State | undefined = countries['us'] const state: State | undefined = countries['us']
? countries['us'].states[stateCode] ? countries['us'].states[stateCode]
@ -90,6 +84,13 @@ async function main() {
if (!province) return if (!province) return
guide.name = province.name guide.name = province.name
guidesByCanadaProvince.push(guide) guidesByCanadaProvince.push(guide)
} else {
const [countryCode] = code.split('-')
const country: Country | undefined = countries[countryCode]
if (!country) return
guide.flag = country.flag
guide.name = country.name
guidesByCountry.push(guide)
} }
}) })