0.0.2 • Published 5 years ago

gd-javascript v0.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

gd-javascript

Javascript client to interact with General Data

Installation

Install the package with: npm install gd-javascript --save

Usage

The package needs to be configured for production usage with the API key provided from your General Data account.

let GeneralData = require('gd-javascript').GeneralData;
let gd = new GeneralData('api_key');
let largest_cities = await gd.get(gd.types["country"], "largest_city");

Country

Basic country information can be extracted by using the get function.

let GeneralData = require('gd-javascript').GeneralData;
let gd = new GeneralData('api_key');
let largest_cities = await gd.get(gd.types["country"], "population");

State

Basic state information can be extracted by using the get function. It should be noted that you will need to provide the country name associated with the state.

let GeneralData = require('gd-javascript').GeneralData;
let gd = new GeneralData('api_key');
let largest_cities = await gd.get(gd.types["state"], "area");

Border

You can find if a country (or state) borders another country (or state).

let GeneralData = require('gd-javascript').GeneralData;
let gd = new GeneralData('api_key');

// Check if two countries share a border
let has_country_border = await gd.borders(gd.types["country"], "United States", "Mexico");

// Check if two states share a border
let has_country_border = await gd.borders(gd.types["state"], "Texas, United States", "Coahuila, Mexico");