/airnow-aqi-js

A package for computing AQI values as defined by airnow.gov

Primary LanguageTypeScript

Airnow AQI

JavaScript utility for converting PPM readings to AQI values (as defined by airnow.gov as of Sept 2018) based on this reference document.

Currently supported pollutant types:

  • PM2.5
  • PM10

Installation

npm install --save airnow-aqi

Usage

import { computeAqi } from "airnow-aqi";
computeAqi([
  // provide an array of type and ppm reading values
  {
    type: "pm2.5", // valid types are "pm2.5" and "pm10"
    ppm: 10,
  },
]); // -> numeric AQI value is returned, -1 if PPM values are out of range.

TypeScript typings are provided for this package.