Socket
Socket
Sign inDemoInstall

@ntegral/country-state-city

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.4 to 1.0.5

10

dist/index.d.ts
import { ICountry, IState } from "./interfaces/csc.interface";
export { ICountry, IState };
export declare class csc {
getAllCountries(): ICountry[];
getCountryById(id: number): ICountry;
getCountryByCode(code: string): ICountry;
getStatesByCountry(countryId: number): IState[];
private compare;
static getAllCountries(): ICountry[];
static getCountryById(id: number): ICountry;
static getCountryByCode(code: string): ICountry;
static getStatesByCountry(countryId: number): IState[];
private static compare;
}

@@ -6,9 +6,9 @@ "use strict";

class csc {
getAllCountries() {
static getAllCountries() {
return countries;
}
getCountryById(id) {
static getCountryById(id) {
return countries.find(c => c.id === id);
}
getCountryByCode(code) {
static getCountryByCode(code) {
if (code.length === 3) {

@@ -21,7 +21,7 @@ return countries.find(c => c.iso3 === code);

}
getStatesByCountry(countryId) {
static getStatesByCountry(countryId) {
let result = states.filter(s => s.country_id === countryId);
return result.sort(this.compare);
}
compare(a, b) {
static compare(a, b) {
if (a.name < b.name) {

@@ -28,0 +28,0 @@ return -1;

@@ -8,11 +8,11 @@ import countries = require("./data/countries.json");

getAllCountries(): ICountry[] {
static getAllCountries(): ICountry[] {
return countries as ICountry[];
}
getCountryById(id: number): ICountry {
static getCountryById(id: number): ICountry {
return countries.find(c => c.id === id) as ICountry;
}
getCountryByCode(code: string): ICountry {
static getCountryByCode(code: string): ICountry {
if (code.length === 3) {

@@ -25,3 +25,3 @@ return countries.find(c => c.iso3 === code) as ICountry;

getStatesByCountry(countryId:number): IState[] {
static getStatesByCountry(countryId:number): IState[] {
let result = states.filter(s => s.country_id === countryId) as IState[];

@@ -31,3 +31,3 @@ return result.sort(this.compare);

private compare(a:any,b:any) {
private static compare(a:any,b:any) {
if(a.name < b.name) {

@@ -34,0 +34,0 @@ return -1;

@@ -10,3 +10,3 @@ {

"name": "@ntegral/country-state-city",
"version": "1.0.4",
"version": "1.0.5",
"description": "Full database of city, state and countries",

@@ -13,0 +13,0 @@ "main": "./dist/index.js",

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