central-cities
v1.2.0
Published
NPM package to get the capital of the countries
Downloads
2
Readme
Central Cities
NPM package to get the capital of the countries
Getting Started
Prerequisites
node -v
node: >= v8.3
Installing
Using npm
npm install --save central-cities
npm i central-cities
Using Yarn
yarn add central-cities
How to use
Importing with Commonjs style
const Countries = require('central-cities')
const countries = new Countries()
Importing with ES6 modules style
import Countries from 'central-cities'
const countries = new Countries()
Filter by name
const portugal = countries.byName('portugal')
/**
* Get all country data
[{
"country": "Portugal",
"city": "Lisboa",
"independence": "1143",
"location": "Southern Europe"
}]
*/
portugal.toJson()
// get capital
portugal.capital // Lisboa