country-list icon indicating copy to clipboard operation
country-list copied to clipboard

`UK` could not be resolved

Open smeijer opened this issue 4 years ago • 1 comments

I have a dataset that uses UK for United Kingdom, but that one is absent in this library.

smeijer avatar Aug 07 '20 16:08 smeijer

@smeijer This uses ISO 3166-1-alpha-2 codes. UK is not a valid code, it would be GB. You will have to manually change your data set.

p12y avatar Jan 20 '21 02:01 p12y

It's correct what @p12y is saying. And yeah, you can use the overwrite functionality to add the UK code.

const { overwrite, getName } = require('country-list');
overwrite([{
  "code": "UK",
  "name": "United Kingdom of Great Britain and Northern Ireland"
}])

console.log(getName('UK')); // United Kingdom of Great Britain and Northern Ireland
console.log(getName('GB')); // United Kingdom of Great Britain and Northern Ireland

fannarsh avatar Dec 04 '22 19:12 fannarsh