New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

country-list-js

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

country-list-js - npm Package Compare versions

Comparing version 0.0.3 to 1.0.0

3

gulpfile.js

@@ -18,4 +18,3 @@ let gulp = require('gulp');

.pipe(notify("Build complete"))
.pipe(gulp.dest('./dist'))
.pipe(gulp.dest('./docs'));
.pipe(gulp.dest('./dist'));
});

@@ -22,0 +21,0 @@

{
"name": "country-list-js",
"version": "0.0.3",
"version": "1.0.0",
"description": "Country list with ISO2, ISO3 code, continent, capital, dialing code",

@@ -24,3 +24,3 @@ "homepage": "https://github.com/i-rocky/country-list-js.git",

],
"main": "./build/index.js",
"main": "src/index.js",
"keywords": [

@@ -27,0 +27,0 @@ "country",

@@ -0,0 +0,0 @@ ## Country List JS

"use strict";
import continents from '../data/continents';
import continent from '../data/continent';
import iso_alpha_3 from '../data/iso_alpha_3';
import capital from '../data/capital';
import currency from '../data/currency';
import currency_info from '../data/currency_info';
import names from '../data/names';
import phone from '../data/phone';
const continents = require('./../data/continents.json');
const continent = require('../data/continent.json');
const iso_alpha_3 = require('../data/iso_alpha_3.json');
const capital = require('../data/capital.json');
const currency = require('../data/currency.json');
const currency_info = require('../data/currency_info.json');
const names = require('../data/names.json');
const phone = require('../data/phone.json');
function Country() {
function Country () {
let countryInfo = null;

@@ -33,3 +33,3 @@

* Looks up the needle according to flag and returns found result
*
*
* @param needle

@@ -40,26 +40,21 @@ * @param flag

this.find = function (needle, flag = 1) {
switch (parseInt(flag)) {
case this.FIND_BY_ISO_ALPHA_2:
if(needle===null || needle===undefined) {
countryInfo = null;
return null;
}
countryInfo = pullDataForCountry(needle);
return countryInfo;
break;
case this.FIND_BY_ISO_ALPHA_3:
return findByISO_ALPHA_3(needle);
break;
case this.FIND_BY_NAME:
return findByName(needle);
break;
case this.FIND_BY_CAPITAL:
return findByCapital(needle);
break;
case this.FIND_BY_CURRENCY:
return findByCurrency(needle);
break;
default:
countryInfo = pullDataForCountry(needle);
return countryInfo;
let number = parseInt(flag);
if (number === this.FIND_BY_ISO_ALPHA_2) {
if (needle === null || needle === undefined) {
countryInfo = null;
return null;
}
countryInfo = pullDataForCountry(needle);
return countryInfo;
} else if (number === this.FIND_BY_ISO_ALPHA_3) {
return findByISO_ALPHA_3(needle);
} else if (number === this.FIND_BY_NAME) {
return findByName(needle);
} else if (number === this.FIND_BY_CAPITAL) {
return findByCapital(needle);
} else if (number === this.FIND_BY_CURRENCY) {
return findByCurrency(needle);
} else {
countryInfo = pullDataForCountry(needle);
return countryInfo;
}

@@ -70,3 +65,3 @@ };

* Pulls data from previous result
*
*
* @param hook

@@ -79,25 +74,18 @@ * @returns {*}

}
switch (hook) {
case "iso_alpha_2":
return countryInfo.code.iso_alpha_2;
break;
case "iso_alpha_3":
return countryInfo.code.iso_alpha_3;
break;
case "name":
return countryInfo.name;
break;
case "continent":
return countryInfo.continent;
break;
case "capital":
return countryInfo.capital;
case "currency":
return countryInfo.currency;
break;
case "dialing_code":
return countryInfo.dialing_code;
break;
default:
return countryInfo;
if (hook === "iso_alpha_2") {
return countryInfo.code.iso_alpha_2;
} else if (hook === "iso_alpha_3") {
return countryInfo.code.iso_alpha_3;
} else if (hook === "name") {
return countryInfo.name;
} else if (hook === "continent") {
return countryInfo.continent;
} else if (hook === "capital") {
return countryInfo.capital;
} else if (hook === "currency") {
return countryInfo.currency;
} else if (hook === "dialing_code") {
return countryInfo.dialing_code;
} else {
return countryInfo;
}

@@ -108,3 +96,3 @@ };

* Populates country data
*
*
* @param code

@@ -149,3 +137,3 @@ * @returns {*}

* Finds for a needle in haystack
*
*
* @param haystack

@@ -170,3 +158,2 @@ * @param needle

global.Country = Country;
module.exports = Country;
module.exports = Country;

@@ -0,0 +0,0 @@ "use strict";

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc