Socket
Socket
Sign inDemoInstall

country-region-data

Package Overview
Dependencies
0
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.7.0 to 3.0.0

13

package.json
{
"name": "country-region-data",
"version": "2.7.0",
"description": "List of countries, regions, and their short-codes.",
"main": "dist/data.js",
"version": "3.0.0",
"description": "List of countries, regions, and their shortcodes.",
"main": "dist/data-umd.js",
"module": "dist/data.js",
"typings": "dist/data.d.ts",

@@ -13,3 +14,3 @@ "scripts": {

"type": "git",
"url": "https://github.com/benkeen/country-region-data.git"
"url": "https://github.com/country-regions/country-region-data.git"
},

@@ -24,5 +25,5 @@ "keywords": [

"bugs": {
"url": "https://github.com/benkeen/country-region-data/issues"
"url": "https://github.com/country-regions/country-region-data/issues"
},
"homepage": "https://github.com/benkeen/country-region-data",
"homepage": "https://github.com/country-regions/country-region-data",
"devDependencies": {

@@ -29,0 +30,0 @@ "grunt": "^1.1.0",

# country-region-data
[![Build Status](https://travis-ci.com/country-regions/country-region-data.svg?branch=master)](https://travis-ci.org/country-regions/country-region-data)
This repo provides country and region data in three different formats: es6, UMD (Unified Module Definition) and

@@ -10,13 +8,18 @@ plain JSON. The data contains country names, country short codes, country regions, and country region short

I created this repo to house the raw data used for the [country-region-selector](https://github.com/country-regions/country-region-selector),
[react-country-region-selector](https://github.com/country-regions/react-country-region-selector) scripts. I didn't want to
duplicate it in multiple places and hey, it seemed like this could be useful as a standalone repo.
Countries can subdivide themselves in all sorts of different ways, often overlapping. They may have states, provinces,
regions, districts, municipalities, and more. The goal of this repo was to house whatever subdivisions makes sense from
the viewpoint of _addressing_, and for that we use [ISO-3166-2](https://en.wikipedia.org/wiki/ISO_3166-2).
The raw data here is used for the [country-region-selector](https://github.com/country-regions/country-region-selector),
[react-country-region-selector](https://github.com/country-regions/react-country-region-selector) scripts but can be used
independently for whatever you want.
### Install
This package is available as an npm package. You can install via npm or yarn:
This package is available as an npm package. Install with your package manager of choice:
```
pnpm install country-region-data
yarn add country-region-data
npm install country-region-data
yarn add country-region-data
```

@@ -31,8 +34,8 @@

{
"countryName":"Ecuador",
"countryShortCode":"EC",
"regions":[
"countryName": "Ecuador",
"countryShortCode": "EC",
"regions": [
{
"name":"Azuay",
"shortCode":"A"
"name": "Azuay",
"shortCode": "A"
},

@@ -54,5 +57,5 @@ ...

The first one is an es6 file containing all the data in tree-shakeable format; the second is an UMD file containing the
entire content. Up until v2 of this repo, UMD was the default. Now the es6 export is the default and the typings reflects
the content of that file, not UMD.
The first one is an es6 file containing all the data in tree-shakeable format; the second is a UMD file containing the
entire content. As of 3.0.0, the `main` package.json entry links to the UMD format and the `module` entry
links to the es6 format.

@@ -80,11 +83,13 @@ ### How to use

```jsx harmony
import json from 'country-region-data/data.json';
const json = require('country-region-data/data.json');
```
Note I slipped into CJS there - node lets you read JSON files by default, so if you want in es6 format (`import json from X`),
you'll need to configure your system (webpack, rollup etc.) with a loader/plugin to let it read JSON directly.
### Typings
So this bit I'm not sure about... so ping me if I'm wrong or if there's a better way to do it. There are three
different formats for the repo data: JSON, UMD and ES6. I figure es6 is going to be the most likely used format, so the
generated typings file (data.d.ts) is referenced in the "typings" property in the package.json file and should be picked
up by your IDEs.
There are three different formats for the repo data: JSON, UMD and ES6. I figure es6 is going to be the most likely
used format, so the generated typings file (`dist/data.d.ts`) is for the es6 version, and referenced in the "typings"
property in the package.json file. It should be automatically picked up by your IDEs.

@@ -96,6 +101,6 @@ There are no typings for the UMD or JSON format.

Make your changes to the `data.json` file.
Make your changes to the `data.json` file in the root folder.
Updates and fixes to the data is much appreciated! The state/prov abbreviations in particular are not yet complete, so
the more contributors the better. Regions that need ISO3166-2 codes can be identified by having a missing `shortCode`
Updates and fixes to the data is much appreciated! The region abbreviations in particular are not yet complete, so
the more contributors the better. Regions that need ISO-3166-2 codes can be identified by having a missing `shortCode`
property for each region. You can find them by cloning the repo, then running:

@@ -134,2 +139,5 @@

- `3.0.0` - Aug 13, 2023 - Spain, Cayman Islands, Zambia, Romania, Nigeria, Philippines, Pakistan regions and shortcode updates.
- **Breaking change**: the package.json file for this repo now added a `module` entry to link to the es6 format; the older
`main` entry links to the older UMD format. This should work for all bundlers, but let us know if you encounter problems.
- `2.7.0` - Dec 28, 2022 - Romanian regions and shortcodes updated.

@@ -136,0 +144,0 @@ - `2.6.0` - July 28, 2022 - UK counties updated.

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc