UNPKG

@thi.ng/units

Version:

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

18 lines (17 loc) 503 B
import { N } from "./force.js"; import { m } from "./length.js"; import { defUnit, mul, prefix } from "../unit.js"; const J = defUnit("J", "joule", mul(N, m, true)); const kJ = defUnit("kJ", "kilojoule", prefix("k", J)); const MJ = defUnit("MJ", "megajoule", prefix("M", J)); const GJ = defUnit("GJ", "gigajoule", prefix("G", J)); const cal = defUnit("cal", "calorie", mul(J, 4.184, true)); const kcal = defUnit("kcal", "kilocalorie", prefix("k", cal)); export { GJ, J, MJ, cal, kJ, kcal };