Gathering detailed insights and metrics for country-state-city-translate
Gathering detailed insights and metrics for country-state-city-translate
Basic library for Country, State and City
npm install country-state-city-translate
Typescript
Module System
Node Version
NPM Version
79.9
Supply Chain
99.6
Quality
75.6
Maintenance
100
Vulnerability
81.3
License
TypeScript (99.17%)
JavaScript (0.83%)
Total Downloads
1,370
Last Day
1
Last Week
15
Last Month
16
Last Year
140
171 Commits
1 Branches
1 Contributors
Latest Version
3.1.6
Package Id
country-state-city-translate@3.1.6
Unpacked Size
52.26 MB
Size
4.90 MB
File Count
33
NPM Version
8.5.5
Node Version
14.17.3
Publised On
13 Mar 2023
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
0%
15
Compared to previous week
Last month
1,500%
16
Compared to previous month
Last year
-88.6%
140
Compared to previous year
Basic library for Country, State and City - Supporting the Following Languages:
Data Source:
https://github.com/dr5hn/countries-states-cities-database
For any data related issue, you can also raise a Issue here.
npm i country-state-city-translate
v3.1.0
data
folder in the root.v3.0.0
(Major Version Release - Not backward compatible)ES6 Module usage
1// Latest version - v3.0.0 with Tree Shaking to reduce bundle size 2import { Country, State, City } from 'country-state-city'; 3console.log(Country.getAllCountries()) 4console.log(State.getAllStates()) 5 6// Import Interfaces` 7import { ICountry, IState, ICity } from 'country-state-city' 8
AMD Module usage
1// Latest version - v3.0.0 2let Country = require('country-state-city').Country; 3let State = require('country-state-city').State; 4 5console.log(Country.getAllCountries()) 6console.log(State.getAllStates()) 7
below v2.2.0 and above v0.1.8
ES6 Module usage
1import csc from 'country-state-city';
AMD Module usage
1let csc = require('country-state-city').default;
It accepts a valid CountryCode
eg: 'AS'
and returns Country Details
type: json | ICountry
1{ 2 "isoCode": "IN", 3 "name": "India", 4 "phonecode": "91", 5 "flag": "🇮🇳", 6 "currency": "INR", 7 "latitude": "20.00000000", 8 "longitude": "77.00000000", 9 "timezones": [ 10 { 11 "zoneName": "Asia\/Kolkata", 12 "gmtOffset": 19800, 13 "gmtOffsetName": "UTC+05:30", 14 "abbreviation": "IST", 15 "tzName": "Indian Standard Time" 16 } 17 ] 18}
It accepts a valid StateCode
eg: 'TG'
CountryCode
eg: 'IN'
and returns State Details
type: json | ICountry
1{ 2 "name": "Telangana", 3 "isoCode": "TG", 4 "countryCode": "IN", 5 "latitude": "18.11243720", 6 "longitude": "79.01929970" 7}
It accepts a valid CountryCode
and returns all States as Array of JSON
type: array of json | IState
1[ 2 { 3 "name": "Delhi", 4 "isoCode": "DL", 5 "countryCode": "IN", 6 "latitude": "28.70405920", 7 "longitude": "77.10249020" 8 } 9] 10
It accepts a valid CountryCode
, StateCode
and returns all Cities as Array of JSON
type: array of json | ICity
1[ 2 { 3 "name": "New Delhi", 4 "countryCode": "IN", 5 "stateCode": "DL", 6 "latitude": "28.63576000", 7 "longitude": "77.22445000" 8 } 9] 10
It accepts a valid CountryCode
and returns all Cities as Array of JSON
type: array of json | ICity
1[ 2 { 3 "name": "New Delhi", 4 "countryCode": "IN", 5 "stateCode": "DL", 6 "latitude": "28.63576000", 7 "longitude": "77.22445000" 8 } 9] 10
It returns all Countries
type: array of json | ICountry
1[ 2 { 3 "isoCode": "IN", 4 "name": "India", 5 "phonecode": "91", 6 "flag": "🇮🇳", 7 "currency": "INR", 8 "latitude": "20.00000000", 9 "longitude": "77.00000000", 10 "timezones": [ 11 { 12 "zoneName": "Asia\/Kolkata", 13 "gmtOffset": 19800, 14 "gmtOffsetName": "UTC+05:30", 15 "abbreviation": "IST", 16 "tzName": "Indian Standard Time" 17 } 18 ] 19 } 20]
It returns all States
type: array of json | IState
1[ 2 { 3 "name": "Delhi", 4 "isoCode": "DL", 5 "countryCode": "IN", 6 "latitude": "28.70405920", 7 "longitude": "77.10249020" 8 9 } 10]
It returns all Cities
type: array of json | ICity
1[ 2 { 3 "name": "Delhi", 4 "isoCode": "DL", 5 "countryCode": "IN", 6 "latitude": "28.70405920", 7 "longitude": "77.10249020" 8 } 9]
@baywet - For mentoring Javascript to Typescript Conversion
@dr5hn - For updated World Data Dictionary
taylorthurlow - For pointing into right direction - Module Tree Shaking
No vulnerabilities found.
No security vulnerabilities found.