countrydb

Country and region codes DB for node.js

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
countrydb
0.1.07 years ago7 years agoMinified + gzip package size for countrydb in KB

Readme

CountryDB
Country and region codes DB for node.js.

Usage

// JSON database is always stored in `countrydb.db` and it's
// at the moment the only provided member of `countrydb`.
var db = require("countrydb").db;

// DB maps two-letter country codes to an object having name
// and regions. The following will list all country codes and
// their names.
for (var k in db) {
  console.log("COUNTRY: '" + k + "' " + db[k].name);
}

// The following code lists all states in USA.
var regions = db.US.regions;
for (var k in regions) {
  console.log("STATE: '" + k + "' " + regions[k].name);
}