Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request following discussion at #12
I was wrong in my initial issue - I couldn't get it to work in the browser as easily (I actually couldn't find a way of getting web browsers to open the JSON directly either, so it may not be possible to use the library in browser even in its current state).
This PR adds methods to synchronously load the JSON. There is a way of doing it asynchronously, but it is still an experimental part of the JS spec, so I did not include it.
Using the code
Filename conversion
The name conversion is very simple - users can generally specify the English names of places and the conversion will successfully match the filename:
They can also specify the filename directly and it would still work:
I can make this more helpful if you want (for example, adding support for strings like 'United States of America' or 'Democratic Republic of the Congo').
Tests
I've manually tested a range of countries, states and areas.
I have not added any automated tests - I am happy to add some but it would require me to add a test library dependency.