Coder Social home page Coder Social logo

itayze / coronavirus-live-data Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 77 KB

Coronavirus-live-data is a module for extracting the latest data regarding COVID-19

JavaScript 100.00%
coronavirus covid-19 covid19 coronavirus-real-time coronavirus-tracking covid19-data covid-data coronavirus-info covid covid-live-data

coronavirus-live-data's Introduction

Coronavirus Live Data

Coronavirus-live-data is a module for extracting the latest data regarding COVID-19

Installation

This module is distributed on npm. To add it as a dependency, run the following command:

npm install coronavirus-live-data

Usage

Retrieve data by country

the listed functions accept one argument (required) to represent the country.

State representation is supported by one of the following:

  1. ISO Alpha-2 code (e.g.,IL,NL)
  2. ISO Alpha-3 code (e.g.,ISR,NLD)
  3. State name (e.g., Israel, Netherlands)

totalCases(country) returns the updated number of confirmed cases. totalRecovered(country) returns the updated number of recovered. totalDeaths(country) returns the updated number of deaths.

Retrieve worldwide recent data

worldCases,worldRecovered and worldDeaths functions does not require any arguments and retrieve recent numbers accordingly.

Use provided functions with Promise syntax:

const covidData= require('coronavirus-live-data')

covidData.totalCases('il').then((totalCases)=>{
    console.log('total cases in Israel: '+totalCases) 
}).catch((error)=>{
    console.log(error)
})

Data

The data is extracted using web scraping techniques.

as soon as any of the countries update data, it will affect the module immediately.

Examples

Retrieving total recovered in the Netherlands:

covidData.totalRecovered('Netherlands').then((totalRecovered)=>{
    console.log('totalRecovered: '+totalRecovered)
}).catch((error)=>{ 
    console.log(error)
})

Retrieving total cases in Brazil:

covidData.totalCases('BR').then((totalCases)=>{
    console.log('totalCases: '+totalCases)
}).catch((error)=>{ 
    console.log(error)
})

Retrieving world total cases:

covidData.worldCases().then((worldCases)=>{
    console.log('worldCases: '+worldCases)
}).catch((error)=>{
    console.log(error)
})

License

MIT

coronavirus-live-data's People

Contributors

itayze avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.