Coder Social home page Coder Social logo

javascript-bits / countries-with-cities-select Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 13.37 MB

All countries with cities select dropdown

Home Page: https://www.npmjs.com/package/countries-with-cities-select

License: MIT License

JavaScript 100.00%
cities countries-api countries-json dropdown search

countries-with-cities-select's Introduction

npm version npm version npm version

countries-with-cities-select

Retrieve all countries with cities

Table of Contents

Features

  • Get names, codes and cities of all countries
  • Filter cities by country name, country code, continent name

Installing

npm install countries-with-cities-select

OR

yarn add countries-with-cities-select

Once the package is installed you use the require/import approach

const countriesWithCities = require('countries-with-cities-select');

OR

import countriesWithCities from 'countries-with-cities-select'

Or with TypeScript

import * as countriesWithCities from 'countries-with-cities-select'

create a .d.ts file and add

declare module 'countries-with-cities-select'

#Get countries

This will list all countries.

const countriesWithCities = require('countries-with-cities-select');
// To get all countries
countriesWithCities.getCountries();

#Get countries with details

This will retrieve information about countries with code, continent etc. Filter by country name, country code or continent

const countriesWithCities = require('countries-with-cities-select');

countriesWithCities.getCountriesWithDetails();

// To get the countries with code, name or continent name
countriesWithCities.getCountriesWithDetails("kenya");
// use exact code to filter country with code
countriesWithCities.getCountriesWithDetails("KE");
countriesWithCities.getCountriesWithDetails("africa");

#Get cities

This will retrieve information about cities. Filter with country name, country code or continent Empty filter will return no cities

const countriesWithCities = require('countries-with-cities-select');

// To get all cities in a country
countriesWithCities.getCities('kenya'); 

// To get all cities in a continent
countriesWithCities.getCities('africa');

// To get all cities in a country with code
countriesWithCities.getCities('ke');

// To getcity with name
countriesWithCities.getCities('nairobi');

License

MIT

license

Open Source Love

Happy coding, Star before Fork ๐Ÿ˜Š๐Ÿ’ช๐Ÿ’ฏ

countries-with-cities-select's People

Contributors

amrmusharrafa avatar manuelgeek avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

amrmusharrafa

countries-with-cities-select's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.