npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@shootismoke/aqi

v0.1.15

Published

Easily convert between US AQI, CN AQI and raw concentrations in ug/m3

Downloads

2

Readme

npm (scoped) dependencies Status

@shootismoke/aqi

A library to convert between AQI (US or CN) value and pollutant concentration (µg/m³ or ppm) using the following standards:

  • US AQI: United States Environmental Protection Agency (EPA)
  • CN AQI: China Ministry of Environmental Protection (MEP)

⚡ Get Started

Install the package

yarn install @shootismoke/aqi

aqiToRaw(pollutant: Pollutant, aqi: number, aqiType: AqiType = 'US'): number

Converts an AQI value to raw concentration (µg/m³ or ppm).

Arguments:

  • pollutant: Pollutant: One of 'co' | 'h' | 'no2' | 'o3' | 'p' | 'pm10' | 'pm25' | 'so2' | 't' | 'w'
  • aqi: number: The AQI value
  • aqiType: AqiType: One of 'US' | 'CN'
import { aqiToRaw } from '@shootismoke/aqi';

const raw = aqiToRaw('pm25', 57, 'US');
console.log(raw); // 15

aqiToRaw(pollutant: Pollutant, raw: number, aqiType: AqiType = 'US'): number

Converts a raw concentration (µg/m³ or ppm) to AQI value.

Arguments:

  • pollutant: Pollutant: One of 'co' | 'h' | 'no2' | 'o3' | 'p' | 'pm10' | 'pm25' | 'so2' | 't' | 'w'
  • raw: number: The raw concentration
  • aqiType: AqiType: One of 'US' | 'CN'
import { rawToAqi } from '@shootismoke/aqi';

const aqi = aqiToRaw('pm25', 15, 'US');
console.log(aqi); // 57

getUnit(pollutant: Pollutant): Unit

Gets the unit of a pollutant (µg/m³ or ppm).

Arguments:

  • pollutant: Pollutant: One of 'co' | 'h' | 'no2' | 'o3' | 'p' | 'pm10' | 'pm25' | 'so2' | 't' | 'w'
import { getUnit } from '@shootismoke/aqi';

const unit = getUnit('pm25');
console.log(unit); // 'µg/m³'

:raising_hand: Contribute

  1. Fork the repo
  2. Make your changes in your own fork
  3. Create a Pull Request on this repo

:microscope: Tests

Look out for *.spec.ts in the codebase.

yarn test

:books: Resources

  • EPA AQI: Technical Assistance Document for the Reporting of Daily Air Quality – the Air Quality Index (AQI) December 2013) found at http://www.epa.gov/airnow/aqi-technical-assistance-document-dec2013.pdf
  • National Ambient Air Quality Standards for Particulate Matter found at http://www.gpo.gov/fdsys/pkg/FR-2013-01-15/pdf/2012-30946.pdf
  • MEP AQI:
    • GB3095—2012 (2012/02/29) found at http://www.mep.gov.cn/gkml/hbb/bwj/201203/t20120302_224147.htm
    • HJ633-2012 (2012/02/29) found at http://www.zzemc.cn/em_aw/Content/HJ633-2012.pdf

:newspaper: License

GPL-3.0. See LICENSE file for more information.