country-list
country-list copied to clipboard
`UK` could not be resolved
I have a dataset that uses UK
for United Kingdom
, but that one is absent in this library.
@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.
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