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
TypeScript (94.9%)
JavaScript (5.1%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
25,792
Last Day
29
Last Week
114
Last Month
401
Last Year
6,386
16 Stars
56 Commits
5 Forks
2 Watching
1 Branches
4 Contributors
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
45%
29
Compared to previous day
Last week
17.5%
114
Compared to previous week
Last month
12%
401
Compared to previous month
Last year
-28.8%
6,386
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.