UNPKG

@thi.ng/units

Version:

Extensible SI unit creation, conversions, quantities & calculations (incl. ~170 predefined units & constants)

21 lines (20 loc) 625 B
import { s } from "./time.js"; import { defUnit, div, mul, prefix, reciprocal } from "../unit.js"; const Hz = defUnit("Hz", "hertz", reciprocal(s, true)); const kHz = defUnit("kHz", "kilohertz", prefix("k", Hz)); const MHz = defUnit("MHz", "megahertz", prefix("M", Hz)); const GHz = defUnit("GHz", "gigahertz", prefix("G", Hz)); const THz = defUnit("THz", "terahertz", prefix("T", Hz)); const rpm = defUnit("rpm", "rotation per minute", mul(Hz, 1 / 60)); const \u03C9 = defUnit("\u03C9", "radian per second", div(Hz, 2 * Math.PI)); const omega = \u03C9; export { GHz, Hz, MHz, THz, kHz, omega, rpm, \u03C9 };