Git Product home page Git Product logo

worldometer-coronavirus-info's Introduction

worldometer-coronavirus-info V3

This is a npm package which will help you to fetch details directly from worldometer.info.

Installing

npm i worldometer-coronavirus-info

Features

  • Fetched Information Directly from worldometer.info and is accurate
  • Very simple to use
  • Lightweight
  • Easy to understand with docs
  • Returns Country flag and name, which is very usefull in some cases

Example

  • Global Data
const worldometer = require('worldometer-coronavirus-info')
const corona = await worldometer.trackAll()//returns object
  • Country Data
const worldometer = require('worldometer-coronavirus-info')
const corona = await worldometer.trackCountry()//returns object or throw error if false country or no country was provided
  • Typescript Example
import worldometer from 'worldometer-coronavirus-info'
const corona = await worldometer.trackAll()

Golbal Data Properties

The following are given property for Global Data

Properties Description
totalCases Gives total cases
totalDeaths Gives total Death
totalRecovered Gives total Recovered
activeCases Gives Active Cases
closedCases Gives the cases which had an outcome
condition#mild Gives Mild condition number
condition#critical Gives critical condition number
  • If you are having trouble understanding this pls scroll a bit down

Country Data Properties

The following are given property for Country Data

Properties Description
cases#totalCases Gives total Cases
cases#recovered Gives total recovered
cases#deaths Gives total deaths
closedCases#percentage#discharge Gives discharge percent
closedCases#percentage#death Gives Death Percent
closedCases#total Gives total closed cases number
country#flagImg Gives image of flag of the country in gif format but is static
country#name Gives the country name
  • If you are having trouble understanding this pls scroll a bit down

Using Global Data

const corona =await worldometer.trackAll()//returns object
const totalCases = corona.totalCases //returns total cases
const totalDeaths = corona.totalDeaths
const totalRecovered = corona.totalRecovered
const activeCases = corona.activeCases
const closedCases = corona.closedCases
const mildCases = corona.condition.mild
const criticalCases=corona.condition.critical

Using Country Data

const corona = await worldometer.trackCountry('united states')
const totalCases = corona.cases.total //total cases
const recovered = corona.cases.recovered
const deaths = corona.cases.deaths
const dischargePercent = corona.closedCases.percentage.discharge
const deathPercent = corona.closedCases.percentage.death
const closedCases = corona.closedCases.total
const flagImg = corona.country.flagImg //returns flag image ex:https://www.worldometers.info/img/flags/small/tn_us-flag.gif
const countryName = corona.country.name

Typescript

  • here is an compiler example to use this package
{
    "compilerOptions": {
    "noImplicitAny": false,
    "strictNullChecks": true,
    "esModuleInterop":true,
    "target": "ES2018", 
    "module": "commonjs",
    "allowJs": true,
    "moduleResolution": "node",
    "sourceMap": true,
    "lib": ["es2018", "dom"],
    "strict": true
    }
}

Changelog

V 2.2.6 - Added Typescript support!!

V 2.8.0 - Rewritten in typescript.

V 3.0.0 - Added Mild And Critical Condition Count to global data

worldometer-coronavirus-info's People

Contributors

abh80 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

sohamksuvarna

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.