Gathering detailed insights and metrics for countries-states-cities-service
Gathering detailed insights and metrics for countries-states-cities-service
Gathering detailed insights and metrics for countries-states-cities-service
Gathering detailed insights and metrics for countries-states-cities-service
Get the World's countries, states, regions and cities
npm install countries-states-cities-service
Typescript
Module System
Min. Node Version
Node Version
NPM Version
60.2
Supply Chain
90.3
Quality
75.8
Maintenance
100
Vulnerability
100
License
TypeScript (94.9%)
JavaScript (5.1%)
Total Downloads
28,395
Last Day
35
Last Week
243
Last Month
761
Last Year
6,407
MIT License
16 Stars
56 Commits
5 Forks
1 Watchers
1 Branches
4 Contributors
Updated on Apr 18, 2025
Minified
Minified + Gzipped
Latest Version
1.3.4
Package Id
countries-states-cities-service@1.3.4
Unpacked Size
32.16 kB
Size
11.73 kB
File Count
8
NPM Version
8.19.2
Node Version
14.21.2
Cumulative downloads
Total Downloads
Last Day
483.3%
35
Compared to previous day
Last Week
29.3%
243
Compared to previous week
Last Month
18%
761
Compared to previous month
Last Year
-25.1%
6,407
Compared to previous year
21
To get started with this library, you need to install it and add it to your project.
Countries States Cities Service is available as an npm package.
1# npm 2npm install countries-states-cities-service 3 4# yarn 5yarn add countries-states-cities-service
Import single named import as follow:
1import { Countries, States, Cities } from 'countries-states-cities-service'
The code snippet below shows how to put into action countries-states-cities-service
in some common use cases.
1const countries = Countries.getCountries()
asc
sort.1const countries = Countries.getCountries({ 2 sort: { 3 mode: 'asc', 4 }, 5})
desc
sort.1const countries = Countries.getCountries({ 2 sort: { 3 mode: 'desc', 4 }, 5})
1const countries = Countries.getCountries({ 2 sort: { 3 mode: 'alphabetical', 4 key: 'iso2', 5 }, 6})
1const countries = Countries.getCountries({ locale: 'it' })
1const countries = Countries.getCountries({ filters: { iso2: 'US' } })
1const countries = Countries.getCountries({ 2 filters: { iso2: 'IT' }, 3 locale: 'it', 4})
1const countries = Countries.getCountries({ filters: { iso3: 'ITA' } })
1const states = States.getStates()
asc
sort.1const states = States.getStates({ 2 sort: { 3 mode: 'asc', 4 }, 5})
desc
sort.1const states = States.getStates({ 2 sort: { 3 mode: 'desc', 4 }, 5})
alphabetical
sort.1const states = States.getStates({ 2 sort: { 3 mode: 'alphabetical', 4 key: 'name', 5 }, 6})
1const states = States.getStates({ locale: 'it' })
1const states = States.getStates({ filters: { country_code: 'IT' } })
1const states = States.getStates({ 2 filters: { country_code: 'IT' }, 3 locale: 'it', 4})
1const states = States.getStates({ 2 filters: { 3 country_code: 'IT', 4 is_region: true, 5 }, 6})
1const states = States.getStates({ 2 filters: { 3 country_code: 'IT', 4 state_code: 'GE', 5 }, 6})
1const cities = Cities.getCities()
asc
sort.1const cities = Cities.getCities({ 2 sort: { 3 mode: 'asc', 4 }, 5})
desc
sort.1const cities = Cities.getCities({ 2 sort: { 3 mode: 'desc', 4 }, 5})
alphabetical
sort.1const cities = Cities.getCities({ 2 sort: { 3 mode: 'alphabetical', 4 key: 'name', 5 }, 6})
1const cities = Cities.getCities({ 2 filters: { 3 country_code: 'IT', 4 }, 5})
1const cities = Cities.getCities({ 2 filters: { 3 country_code: 'IT', 4 state_code: '42', // Region iso2 5 }, 6})
Any contribution is appreciated. You can get started with the steps below:
Fork this repository (learn how to do this here).
Clone the forked repository.
Make your changes and create a pull request (learn how to do this).
I will attend to your pull request and provide some feedback.
Ping me on Twitter
This repository is licensed under the MIT License.
Don't be shy! 😜
No vulnerabilities found.
No security vulnerabilities found.