Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(units): rename builtin units, update readme
- Loading branch information
1 parent
73c941a
commit 22031e6
Showing
21 changed files
with
554 additions
and
534 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
import { RAD } from "./angle.js"; | ||
import { FT, M } from "./length.js"; | ||
import { S } from "./time.js"; | ||
import { rad } from "./angle.js"; | ||
import { ft, m } from "./length.js"; | ||
import { s } from "./time.js"; | ||
import { defUnit, div, mul, pow } from "./unit.js"; | ||
|
||
export const M_S2 = defUnit( | ||
export const m_s2 = defUnit( | ||
"m/s2", | ||
"meter per second squared", | ||
div(M, pow(S, 2)) | ||
div(m, pow(s, 2)) | ||
); | ||
|
||
export const FT_S2 = defUnit( | ||
export const ft_s2 = defUnit( | ||
"ft/s2", | ||
"foot per second squared", | ||
div(FT, pow(S, 2)) | ||
div(ft, pow(s, 2)) | ||
); | ||
|
||
export const RAD_S2 = defUnit( | ||
export const rad_s2 = defUnit( | ||
"rad/s2", | ||
"radian per second squared", | ||
div(RAD, pow(S, 2)) | ||
div(rad, pow(s, 2)) | ||
); | ||
|
||
export const G0 = defUnit("g0", "standard gravity", mul(M_S2, 9.80665)); | ||
export const g0 = defUnit("g0", "standard gravity", mul(m_s2, 9.80665)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { CM, FT, IN, KM, M, MI, MM } from "./length.js"; | ||
import { cm, ft, inch, km, m, mi, mm } from "./length.js"; | ||
import { defUnit, mul, pow } from "./unit.js"; | ||
|
||
export const M2 = defUnit("m2", "square meter", pow(M, 2)); | ||
export const MM2 = defUnit("mm2", "square millimeter", pow(MM, 2)); | ||
export const CM2 = defUnit("cm2", "square centimeter", pow(CM, 2)); | ||
export const KM2 = defUnit("km2", "square kilometer", pow(KM, 2)); | ||
export const HA = defUnit("ha", "hectar", mul(M2, 1e4)); | ||
export const m2 = defUnit("m2", "square meter", pow(m, 2)); | ||
export const mm2 = defUnit("mm2", "square millimeter", pow(mm, 2)); | ||
export const cm2 = defUnit("cm2", "square centimeter", pow(cm, 2)); | ||
export const km2 = defUnit("km2", "square kilometer", pow(km, 2)); | ||
export const ha = defUnit("ha", "hectar", mul(m2, 1e4)); | ||
|
||
export const AC = defUnit("ac", "acre", mul(M2, 4046.86)); | ||
export const SQIN = defUnit("sqin", "square inch", pow(IN, 2)); | ||
export const SQFT = defUnit("sqft", "square foot", pow(FT, 2)); | ||
export const SQMI = defUnit("sqmi", "square mile", pow(MI, 2)); | ||
export const ac = defUnit("ac", "acre", mul(m2, 4046.86)); | ||
export const sqin = defUnit("sqin", "square inch", pow(inch, 2)); | ||
export const sqft = defUnit("sqft", "square foot", pow(ft, 2)); | ||
export const sqmi = defUnit("sqmi", "square mile", pow(mi, 2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
import { defUnit, dimensionless, mul, prefix } from "./unit.js"; | ||
|
||
export const BIT = defUnit("bit", "bit", dimensionless(1, 0, true)); | ||
export const KBIT = defUnit("kbit", "kilobit", prefix("k", BIT)); | ||
export const MBIT = defUnit("Mbit", "megabit", prefix("M", BIT)); | ||
export const GBIT = defUnit("Gbit", "gigabit", prefix("G", BIT)); | ||
export const TBIT = defUnit("Tbit", "terabit", prefix("T", BIT)); | ||
|
||
export const BYTE = defUnit("B", "byte", mul(BIT, 8, true)); | ||
export const KBYTE = defUnit("KB", "kilobyte", mul(BYTE, 1024)); | ||
export const MBYTE = defUnit("MB", "megabyte", mul(KBYTE, 1024)); | ||
export const GBYTE = defUnit("GB", "gigabyte", mul(MBYTE, 1024)); | ||
export const TBYTE = defUnit("TB", "terabyte", mul(GBYTE, 1024)); | ||
export const PBYTE = defUnit("PB", "petabyte", mul(TBYTE, 1024)); | ||
export const EBYTE = defUnit("EB", "exabyte", mul(PBYTE, 1024)); | ||
export const bit = defUnit("bit", "bit", dimensionless(1, 0, true)); | ||
export const kbit = defUnit("kbit", "kilobit", prefix("k", bit)); | ||
export const Mbit = defUnit("Mbit", "megabit", prefix("M", bit)); | ||
export const Gbit = defUnit("Gbit", "gigabit", prefix("G", bit)); | ||
export const Tbit = defUnit("Tbit", "terabit", prefix("T", bit)); | ||
|
||
// https://en.wikipedia.org/wiki/Byte#Multiple-byte_units | ||
|
||
export const B = defUnit("B", "byte", mul(bit, 8, true)); | ||
export const kB = defUnit("kB", "kilobyte", prefix("k", B)); | ||
export const MB = defUnit("MB", "megabyte", prefix("M", B)); | ||
export const GB = defUnit("GB", "gigabyte", prefix("G", B)); | ||
export const TB = defUnit("TB", "terabyte", prefix("T", B)); | ||
export const PB = defUnit("PB", "petabyte", prefix("P", B)); | ||
export const EB = defUnit("EB", "exabyte", prefix("E", B)); | ||
|
||
export const KiB = defUnit("KiB", "kibibyte", mul(B, 1024)); | ||
export const MiB = defUnit("MiB", "mebibyte", mul(KiB, 1024)); | ||
export const GiB = defUnit("GiB", "gibibyte", mul(MiB, 1024)); | ||
export const TiB = defUnit("TiB", "tebibyte", mul(GiB, 1024)); | ||
export const PiB = defUnit("PiB", "pebibyte", mul(TiB, 1024)); | ||
export const EiB = defUnit("EiB", "exbibyte", mul(PiB, 1024)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,29 @@ | ||
import { M2 } from "./area.js"; | ||
import { m2 } from "./area.js"; | ||
import { J } from "./energy.js"; | ||
import { H, S } from "./time.js"; | ||
import { h, s } from "./time.js"; | ||
import { defUnit, div, mul, prefix, unit } from "./unit.js"; | ||
|
||
export const A = defUnit("A", "ampere", unit(3, 1, 0, true)); | ||
export const MA = defUnit("mA", "milliampere", prefix("m", A)); | ||
export const MA_H = defUnit("mAh", "milliampere-hour", mul(MA, H)); | ||
export const mA = defUnit("mA", "milliampere", prefix("m", A)); | ||
export const mAh = defUnit("mAh", "milliampere-hour", mul(mA, h)); | ||
|
||
export const C = defUnit("C", "coulomb", mul(A, S, true)); | ||
export const C = defUnit("C", "coulomb", mul(A, s, true)); | ||
|
||
export const V = defUnit("V", "volt", div(J, C, true)); | ||
export const MV = defUnit("mV", "millivolt", prefix("m", V)); | ||
export const KV = defUnit("kV", "kilovolt", prefix("k", V)); | ||
export const mV = defUnit("mV", "millivolt", prefix("m", V)); | ||
export const kV = defUnit("kV", "kilovolt", prefix("k", V)); | ||
export const MV = defUnit("MV", "megavolt", prefix("M", V)); | ||
|
||
export const F = defUnit("F", "farad", div(C, V, true)); | ||
export const PF = defUnit("pF", "picofarad", prefix("p", F)); | ||
export const pF = defUnit("pF", "picofarad", prefix("p", F)); | ||
export const µF = defUnit("µF", "microfarad", prefix("µ", F)); | ||
|
||
export const OHM = defUnit("Ω", "ohm", div(V, A, true)); | ||
export const KOHM = defUnit("kΩ", "kiloohm", prefix("k", OHM)); | ||
export const MOHM = defUnit("MΩ", "megaohm", prefix("M", OHM)); | ||
export const GOHM = defUnit("GΩ", "gigaohm", prefix("G", OHM)); | ||
export const Ω = defUnit("Ω", "ohm", div(V, A, true)); | ||
export const kΩ = defUnit("kΩ", "kiloohm", prefix("k", Ω)); | ||
export const MΩ = defUnit("MΩ", "megaohm", prefix("M", Ω)); | ||
export const GΩ = defUnit("GΩ", "gigaohm", prefix("G", Ω)); | ||
|
||
export const SIEMENS = defUnit("S", "siemens", div(A, V, true)); | ||
export const WB = defUnit("Wb", "weber", mul(V, S, true)); | ||
export const TESLA = defUnit("T", "tesla", div(WB, M2, true)); | ||
export const HENRY = defUnit("H", "henry", div(WB, A, true)); | ||
export const S = defUnit("S", "siemens", div(A, V, true)); | ||
export const Wb = defUnit("Wb", "weber", mul(V, s, true)); | ||
export const T = defUnit("T", "tesla", div(Wb, m2, true)); | ||
export const H = defUnit("H", "henry", div(Wb, A, true)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { N } from "./force.js"; | ||
import { M } from "./length.js"; | ||
import { m } from "./length.js"; | ||
import { defUnit, mul, prefix } from "./unit.js"; | ||
|
||
export const J = defUnit("J", "joule", mul(N, M, true)); | ||
export const KJ = defUnit("kJ", "kilojoule", prefix("k", J)); | ||
export const J = defUnit("J", "joule", mul(N, m, true)); | ||
export const kJ = defUnit("kJ", "kilojoule", prefix("k", J)); | ||
export const MJ = defUnit("MJ", "megajoule", prefix("M", J)); | ||
export const GJ = defUnit("GJ", "gigajoule", prefix("G", J)); | ||
export const CAL = defUnit("cal", "calorie", mul(J, 4.184, true)); | ||
export const KCAL = defUnit("kcal", "kilocalorie", prefix("k", CAL)); | ||
export const cal = defUnit("cal", "calorie", mul(J, 4.184, true)); | ||
export const kcal = defUnit("kcal", "kilocalorie", prefix("k", cal)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { M_S2 } from "./accel.js"; | ||
import { KG } from "./mass.js"; | ||
import { m_s2 } from "./accel.js"; | ||
import { kg } from "./mass.js"; | ||
import { defUnit, mul } from "./unit.js"; | ||
|
||
export const N = defUnit("N", "newton", mul(KG, M_S2, true)); | ||
export const N = defUnit("N", "newton", mul(kg, m_s2, true)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { S } from "./time.js"; | ||
import { s } from "./time.js"; | ||
import { defUnit, div, mul, prefix, reciprocal } from "./unit.js"; | ||
|
||
export const HZ = defUnit("Hz", "hertz", reciprocal(S, true)); | ||
export const KHZ = defUnit("kHz", "kilohertz", prefix("k", HZ)); | ||
export const MHZ = defUnit("MHz", "megahertz", prefix("M", HZ)); | ||
export const GHZ = defUnit("GHz", "gigahertz", prefix("G", HZ)); | ||
export const THZ = defUnit("THz", "terahertz", prefix("T", HZ)); | ||
export const RPM = defUnit("rpm", "rotation per minute", mul(HZ, 1 / 60)); | ||
export const Hz = defUnit("Hz", "hertz", reciprocal(s, true)); | ||
export const kHz = defUnit("kHz", "kilohertz", prefix("k", Hz)); | ||
export const MHz = defUnit("MHz", "megahertz", prefix("M", Hz)); | ||
export const GHz = defUnit("GHz", "gigahertz", prefix("G", Hz)); | ||
export const THz = defUnit("THz", "terahertz", prefix("T", Hz)); | ||
export const rpm = defUnit("rpm", "rotation per minute", mul(Hz, 1 / 60)); | ||
|
||
export const OMEGA = defUnit("ω", "radian per second", div(HZ, 2 * Math.PI)); | ||
export const ω = defUnit("ω", "radian per second", div(Hz, 2 * Math.PI)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import { defUnit, mul, prefix, unit } from "./unit.js"; | ||
|
||
export const M = defUnit("m", "meter", unit(1, 1, 0, true)); | ||
export const CM = defUnit("cm", "centimeter", prefix("c", M)); | ||
export const MM = defUnit("mm", "millimeter", prefix("m", M)); | ||
export const µM = defUnit("µm", "micrometer", prefix("µ", M)); | ||
export const NM = defUnit("nm", "nanometer", prefix("n", M)); | ||
export const KM = defUnit("km", "kilometer", prefix("k", M)); | ||
export const AU = defUnit("au", "astronomical unit", mul(M, 149597870700)); | ||
export const m = defUnit("m", "meter", unit(1, 1, 0, true)); | ||
export const cm = defUnit("cm", "centimeter", prefix("c", m)); | ||
export const mm = defUnit("mm", "millimeter", prefix("m", m)); | ||
export const µm = defUnit("µm", "micrometer", prefix("µ", m)); | ||
export const nm = defUnit("nm", "nanometer", prefix("n", m)); | ||
export const km = defUnit("km", "kilometer", prefix("k", m)); | ||
export const au = defUnit("au", "astronomical unit", mul(m, 149597870700)); | ||
|
||
export const IN = defUnit("in", "inch", mul(M, 0.0254)); | ||
export const FT = defUnit("ft", "foot", mul(IN, 12)); | ||
export const YD = defUnit("yd", "yard", mul(FT, 3)); | ||
export const MI = defUnit("mi", "mile", mul(YD, 1760)); | ||
export const NMI = defUnit("nmi", "nautical mile", mul(M, 1852)); | ||
export const inch = defUnit("in", "inch", mul(m, 0.0254)); | ||
export const ft = defUnit("ft", "foot", mul(inch, 12)); | ||
export const yd = defUnit("yd", "yard", mul(ft, 3)); | ||
export const mi = defUnit("mi", "mile", mul(yd, 1760)); | ||
export const nmi = defUnit("nmi", "nautical mile", mul(m, 1852)); | ||
|
||
export const PICA = defUnit("pica", "pica", mul(IN, 1 / 6)); | ||
export const POINT = defUnit("point", "point", mul(IN, 1 / 72)); | ||
export const pica = defUnit("pica", "pica", mul(inch, 1 / 6)); | ||
export const point = defUnit("point", "point", mul(inch, 1 / 72)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { SR } from "./angle.js"; | ||
import { M2 } from "./area.js"; | ||
import { sr } from "./angle.js"; | ||
import { m2 } from "./area.js"; | ||
import { defUnit, div, mul, unit } from "./unit.js"; | ||
|
||
export const CD = defUnit("cd", "candela", unit(6, 1, 0, true)); | ||
export const cd = defUnit("cd", "candela", unit(6, 1, 0, true)); | ||
|
||
export const LM = defUnit("lm", "lumen", mul(CD, SR)); | ||
export const LX = defUnit("lx", "lux", div(LM, M2)); | ||
export const lm = defUnit("lm", "lumen", mul(cd, sr)); | ||
export const lx = defUnit("lx", "lux", div(lm, m2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import { defUnit, mul, prefix, unit } from "./unit.js"; | ||
|
||
export const G = defUnit("g", "gram", unit(0, 1e-3, 0, true)); | ||
export const KG = defUnit("kg", "kilogram", prefix("k", G)); | ||
export const MG = defUnit("mg", "milligram", prefix("m", G)); | ||
export const µG = defUnit("µg", "microgram", prefix("µ", G)); | ||
export const g = defUnit("g", "gram", unit(0, 1e-3, 0, true)); | ||
export const kg = defUnit("kg", "kilogram", prefix("k", g)); | ||
export const mg = defUnit("mg", "milligram", prefix("m", g)); | ||
export const µg = defUnit("µg", "microgram", prefix("µ", g)); | ||
|
||
export const T = defUnit("t", "tonne", prefix("M", G, true)); | ||
export const KT = defUnit("kt", "kilotonne", prefix("k", T)); | ||
export const MT = defUnit("Mt", "megatonne", prefix("M", T)); | ||
export const GT = defUnit("Gt", "gigatonne", prefix("G", T)); | ||
export const t = defUnit("t", "tonne", prefix("M", g, true)); | ||
export const kt = defUnit("kt", "kilotonne", prefix("k", t)); | ||
export const Mt = defUnit("Mt", "megatonne", prefix("M", t)); | ||
export const Gt = defUnit("Gt", "gigatonne", prefix("G", t)); | ||
|
||
export const LB = defUnit("lb", "imperial pound", mul(KG, 0.45359237)); | ||
export const ST = defUnit("st", "stone", mul(LB, 14)); | ||
export const lb = defUnit("lb", "imperial pound", mul(kg, 0.45359237)); | ||
export const st = defUnit("st", "stone", mul(lb, 14)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { J } from "./energy.js"; | ||
import { H, S } from "./time.js"; | ||
import { h, s } from "./time.js"; | ||
import { defUnit, div, mul, prefix } from "./unit.js"; | ||
|
||
export const W = defUnit("W", "watt", div(J, S, true)); | ||
export const MILLI_W = defUnit("mW", "milliwatt", prefix("m", W)); | ||
export const KW = defUnit("kW", "kilowatt", prefix("k", W)); | ||
export const W = defUnit("W", "watt", div(J, s, true)); | ||
export const mW = defUnit("mW", "milliwatt", prefix("m", W)); | ||
export const kW = defUnit("kW", "kilowatt", prefix("k", W)); | ||
export const MW = defUnit("MW", "megawatt", prefix("M", W)); | ||
export const GW = defUnit("GW", "gigawatt", prefix("G", W)); | ||
export const TW = defUnit("TW", "terawatt", prefix("T", W)); | ||
|
||
export const W_H = defUnit("Wh", "watt-hour", mul(W, H, true)); | ||
export const KW_H = defUnit("kWh", "kilowatt-hour", prefix("k", W_H)); | ||
export const Wh = defUnit("Wh", "watt-hour", mul(W, h, true)); | ||
export const kWh = defUnit("kWh", "kilowatt-hour", prefix("k", Wh)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { M2 } from "./area.js"; | ||
import { m2 } from "./area.js"; | ||
import { N } from "./force.js"; | ||
import { defUnit, div, mul, prefix } from "./unit.js"; | ||
|
||
export const PA = defUnit("Pa", "pascal", div(N, M2, true)); | ||
export const KPA = defUnit("kPa", "kilopascal", prefix("k", PA)); | ||
export const MPA = defUnit("MPa", "megapascal", prefix("M", PA)); | ||
export const GPA = defUnit("GPa", "gigapascal", prefix("G", PA)); | ||
export const Pa = defUnit("Pa", "pascal", div(N, m2, true)); | ||
export const kPa = defUnit("kPa", "kilopascal", prefix("k", Pa)); | ||
export const MPa = defUnit("MPa", "megapascal", prefix("M", Pa)); | ||
export const GPa = defUnit("GPa", "gigapascal", prefix("G", Pa)); | ||
|
||
export const AT = defUnit("at", "technical atmosphere", mul(PA, 98066.5)); | ||
export const ATM = defUnit("atm", "atmosphere", mul(PA, 101325)); | ||
export const BAR = defUnit("bar", "bar", mul(PA, 1e5, true)); | ||
export const PSI = defUnit("psi", "pound per square inch", mul(PA, 6894.757)); | ||
export const at = defUnit("at", "technical atmosphere", mul(Pa, 98066.5)); | ||
export const atm = defUnit("atm", "atmosphere", mul(Pa, 101325)); | ||
export const bar = defUnit("bar", "bar", mul(Pa, 1e5, true)); | ||
export const psi = defUnit("psi", "pound per square inch", mul(Pa, 6894.757)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { defUnit, div } from "./unit.js"; | ||
import { FT, KM, M, MI, NMI } from "./length.js"; | ||
import { H, S } from "./time.js"; | ||
import { ft, km, m, mi, nmi } from "./length.js"; | ||
import { h, s } from "./time.js"; | ||
|
||
export const M_S = defUnit("m/s", "meter per second", div(M, S)); | ||
export const KM_H = defUnit("km/h", "kilometer per hour", div(KM, H)); | ||
export const FT_S = defUnit("ft/s", "foot per second", div(FT, S)); | ||
export const MPH = defUnit("mph", "mile per hour", div(MI, H)); | ||
export const KNOT = defUnit("kn", "knot", div(NMI, H)); | ||
export const m_s = defUnit("m/s", "meter per second", div(m, s)); | ||
export const km_h = defUnit("km/h", "kilometer per hour", div(km, h)); | ||
export const ft_s = defUnit("ft/s", "foot per second", div(ft, s)); | ||
export const mph = defUnit("mph", "mile per hour", div(mi, h)); | ||
export const kn = defUnit("kn", "knot", div(nmi, h)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { defUnit, unit } from "./unit.js"; | ||
|
||
export const MOL = defUnit("mol", "mole", unit(5, 1, 0, true)); | ||
export const mol = defUnit("mol", "mole", unit(5, 1, 0, true)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { defUnit, mul, prefix, unit } from "./unit.js"; | ||
|
||
export const S = defUnit("s", "second", unit(2, 1, 0, true)); | ||
export const MS = defUnit("ms", "millisecond", prefix("m", S)); | ||
export const µS = defUnit("µs", "microsecond", prefix("µ", S)); | ||
export const NS = defUnit("ns", "nanosecond", prefix("n", S)); | ||
export const MIN = defUnit("min", "minute", mul(S, 60)); | ||
export const H = defUnit("h", "hour", mul(MIN, 60)); | ||
export const DAY = defUnit("day", "day", mul(H, 24)); | ||
export const WEEK = defUnit("week", "week", mul(DAY, 7)); | ||
export const MONTH = defUnit("month", "month", mul(DAY, 30)); | ||
export const YEAR = defUnit("year", "year", mul(DAY, 365.25)); | ||
export const s = defUnit("s", "second", unit(2, 1, 0, true)); | ||
export const ms = defUnit("ms", "millisecond", prefix("m", s)); | ||
export const µs = defUnit("µs", "microsecond", prefix("µ", s)); | ||
export const ns = defUnit("ns", "nanosecond", prefix("n", s)); | ||
export const min = defUnit("min", "minute", mul(s, 60)); | ||
export const h = defUnit("h", "hour", mul(min, 60)); | ||
export const d = defUnit("day", "day", mul(h, 24)); | ||
export const week = defUnit("week", "week", mul(d, 7)); | ||
export const month = defUnit("month", "month", mul(d, 30)); | ||
export const year = defUnit("year", "year", mul(d, 365.25)); |
Oops, something went wrong.