Socket
Socket
Sign inDemoInstall

country-data

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

country-data - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

CHANGES.md

9

data/countries.json

@@ -1674,3 +1674,2 @@ [

"currencies": [
"SVC",
"USD"

@@ -1981,3 +1980,3 @@ ],

"currencies": [
"ZMK"
"ZMW"
],

@@ -1990,3 +1989,7 @@ "name": "Zambia"

"currencies": [
"ZWL"
"USD",
"ZAR",
"BWP",
"GBP",
"EUR"
],

@@ -1993,0 +1996,0 @@ "name": "Zimbabwe"

@@ -1,6 +0,8 @@

var data_countries = require('./data/countries.json'),
_ = require('underscore');
var data_countries = require('./data/countries.json'),
data_currencies = require('./data/currencies.json'),
_ = require('underscore');
exports.data = {
countries: data_countries
countries: data_countries,
currencies: data_currencies,
};

@@ -18,1 +20,8 @@

exports.currencies = {
code: {},
};
_.each(data_currencies, function (currency) {
exports.currencies.code[currency.code] = currency;
});
{
"name": "country-data",
"version": "0.0.1",
"version": "0.0.2",
"description": "Data about countries - like their ISO codes and currencies",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/LinkToBooks/country-data",

@@ -8,2 +8,4 @@ # Country Data

## Countries
The data currently provided for each country is:

@@ -16,3 +18,12 @@

## Currencies
It is not that useful to just have the currency code(s) for a country, so included is currency data too:
* `name` The english name for the currency
* `code` The [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) code
* `number` The [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) number
* `decimals` The number of decimal digits conventionally shown
## Installing

@@ -28,6 +39,11 @@

``` javascript
var countries = require('country-data').countries;
var countries = require('country-data').countries,
currencies = require('country-data').currencies;
// countries are found using alpha2 or alpha3
console.log( countries.alpha2.BE.name ); // 'Belgium'
console.log( countries.alpha3.FRA.currencies ); // ['EUR']
// currencies are accessed by their code
console.log( currencies.code.USD.name ); // 'United States dollar'
```

@@ -79,1 +95,5 @@

```
## Sources
The currency data was copied from the [Wikipedia ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) page.

@@ -1,3 +0,6 @@

var countries = require('..').countries,
assert = require('assert');
var countries = require('..').countries,
currencies = require('..').currencies,
countryData = require('..').data.countries,
assert = require('assert'),
_ = require('underscore');

@@ -20,2 +23,13 @@ describe('countries', function () {

describe('check currencies for each country', function () {
_.each( countryData, function (country) {
describe(country.alpha2, function () {
_.each( country.currencies, function (currency) {
it(currency, function () {
assert( currencies.code[currency] );
});
});
});
});
});
});

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