npm.io
1.2.0 • Published 5 years ago

central-cities

Licence
MIT
Version
1.2.0
Deps
1
Size
36 kB
Vulns
0
Weekly
0

Central Cities

NPM package to get the capital of the countries

npm npm NPM

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

Keywords