Socket
Socket
Sign inDemoInstall

country-data

Package Overview
Dependencies
Maintainers
2
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.13 to 0.0.14

data/language_csv_to_json.js

8

CHANGES.md
# Changes
## v0.0.14
* Added languages - many thanks to Moritz Lawitschka (@lawitschka) for doing the initial work.
## v0.0.13
* @carlosleopoldo added 521 calling code to Mexico
## v0.0.12

@@ -4,0 +12,0 @@

2

data/country_csv_to_json.js

@@ -31,3 +31,3 @@ // Take the csv and convert to json and tidy it up so that it is consistent.

// change the appropriate fields to be an array
_.each(['currencies', 'countryCallingCodes'], function(key) {
_.each(['currencies', 'countryCallingCodes', 'languages'], function(key) {
_.each(countries, function (country) {

@@ -34,0 +34,0 @@ country[key] = country[key] ? country[key].split(',') : [];

var countriesAll = require('./data/countries.json'),
currenciesAll = require('./data/currencies.json'),
languagesAll = require('./data/languages.json'),
regions = require('./data/regions'),

@@ -24,7 +25,21 @@ lookup = require('./lookup'),

exports.languages = {
all: languagesAll,
};
// Note that for the languages there are several entries with the same alpha3 -
// eg Dutch and Flemish. Not sure how to best deal with that - here whichever
// comes last wins.
_.each(languagesAll, function (language) {
exports.languages[language.alpha2] = language;
exports.languages[language.bibliographic] = language;
exports.languages[language.alpha3] = language;
});
exports.regions = regions;
exports.lookup = lookup({
countries: countriesAll,
currencies: currenciesAll
currencies: currenciesAll,
languages: languagesAll
});

@@ -8,3 +8,4 @@ var _ = require('underscore');

countries: search.bind(null, o.countries),
currencies: search.bind(null, o.currencies)
currencies: search.bind(null, o.currencies),
languages: search.bind(null, o.languages)
};

@@ -11,0 +12,0 @@ }

{
"name": "country-data",
"version": "0.0.13",
"version": "0.0.14",
"description": "Data about countries - like their ISO codes and currencies",

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

@@ -24,2 +24,3 @@ # Country Data

* `currencies` An array of [ISO 4217 currency codes](http://en.wikipedia.org/wiki/ISO_4217) with the primary one first
* `languages` An array of [ISO 639-2](http://en.wikipedia.org/wiki/ISO_639-2) codes for languages (may not be complete).
* `countryCallingCodes` An array of the international call prefixes for this country.

@@ -43,2 +44,11 @@ * `ioc` The [International Olympic Committee country code](http://en.wikipedia.org/wiki/List_of_IOC_country_codes)

## Languages
A list of languages provided by [ISO 639-2](http://en.wikipedia.org/wiki/ISO_639-2);
* `name` The english name for the language
* `alpha2` The two letter [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) code for the language (may be blank).
* `alpha3` The three letter terminological [ISO 639-2](http://en.wikipedia.org/wiki/ISO_639-2) code for the language (may be blank).
* `bibliograpic` The three letter bibliographic [ISO 639-2](http://en.wikipedia.org/wiki/ISO_639-2) code for the language (may be blank).
## Lookup

@@ -61,3 +71,4 @@

currencies = require('country-data').currencies,
regions = regions('country-data').regions;
regions = regions('country-data').regions,
languages = require('country-data').languages;

@@ -64,0 +75,0 @@ // .all gives you an array of all entries

var countries = require('..').countries,
currencies = require('..').currencies,
languages = require('..').languages,
assert = require('assert'),

@@ -33,3 +34,3 @@ _ = require('underscore');

it(currency, function () {
assert( currencies[currency] );
assert( currencies[currency] );
});

@@ -40,2 +41,14 @@ });

});
describe('check languages for each country', function () {
_.each( countries.all, function (country) {
describe(country.alpha2, function () {
_.each( country.languages, function (language) {
it(language, function () {
assert( languages[language] );
});
});
});
});
});
});
var lookup = require('..').lookup,
countries = require('..').countries,
currencies = require('..').currencies,
languages = require('..').languages,
assert = require('chai').assert,

@@ -41,2 +42,12 @@ _ = require('underscore');

describe("check languages by name", function () {
_.each( languages, function (language, name) {
describe(name, function () {
it(name, function () {
if(language.name) assert.include( lookup.languages({name: language.name}), language );
});
});
});
});
});

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

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