Country names: correctly uppercase names like 'EU'
Always perform the capitalization-correction for country names. If we did this naïvely, using the same regex as before, it would change things like "Falkland Islands" to "Falkland ISLANDS". The new regex checks on word boundary, `\b`, instead of space, `\s`, which means even single words like `Eu` are found. It then checks for exactly two letters, where the first is uppercase and the second lowercase. Here's exactly what it affects: * All "Regional Indicator Symbol Letters AC"-type names that don't have data in emojiLib * There are some flags in emojiLib for which it uses two-character abbreviations instead of full country names (see muan/emojilib#131). These countries are: CN, EU, FR, DE, IT, JP, RU, KR, ES, TR, UK, US This new regex corrects these from Cn, Eu, Fr, etc.nolan/hinaloe-test
parent
22adc985b8
commit
a927821c9b
|
@ -78,8 +78,9 @@ emojiData.forEach((datum) => {
|
|||
|
||||
datum.name = inflection.titleize(datum.name || '')
|
||||
|
||||
if (datum.category == 'Flags' && !emojiLibMatch) {
|
||||
datum.name = datum.name.replace(/\s(\w+)$/, (letters) => letters.toUpperCase())
|
||||
if (datum.category == 'Flags') {
|
||||
// uppercase two-letter country codes
|
||||
datum.name = datum.name.replace(/\b[A-Z]([a-z])$/, letters => letters.toUpperCase())
|
||||
}
|
||||
|
||||
if (!datum.name) {
|
||||
|
|
Loading…
Reference in New Issue