shootismoke/common

View on GitHub
packages/ui/src/util/secretSauce.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
// Sh**t! I Smoke
// Copyright (C) 2018-2021  Marcelo S. Coelho, Amaury M.

// Sh**t! I Smoke is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Sh**t! I Smoke is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Sh**t! I Smoke.  If not, see <http://www.gnu.org/licenses/>.

/**
 * Convert raw pm25 level to number of cigarettes. 1 cigarette is equivalent of
 * a PM2.5 level of 22ug/m3.
 *
 * @see https://berkeleyearth.org/air-pollution-and-cigarette-equivalence/
 * @param pm25 - The raw PM2.5 level, in ug/m3.
 */
export function pm25ToCigarettes(pm25: number): number {
    return pm25 / 22;
}