Function: ucumEqual()
ucumEqual(
a,b):boolean
Whether two UCUM expressions denote the same unit - i.e. they reduce to the same canonical
form (equal base dimensions and equal scale). This recognizes representational equivalences
(N ≡ kg.m/s2, mmol/L ≡ mmol.L-1, annotations inert) but is not magnitude conversion:
mg and g are different units and compare unequal.
A unit is never equal to an invalid expression, and a special (non-linear) unit (Cel, [pH]) is
equal only to a structurally identical special unit - never to a linear unit (the never-fabricate
posture: the engine will not assert an equivalence it cannot prove).
Parameters
a
string
The first UCUM unit expression.
b
string
The second UCUM unit expression.
Returns
boolean
true iff both are valid and denote the same unit.
Example
import { ucumEqual } from "@cosyte/terminology";
ucumEqual("N", "kg.m/s2"); // => true
ucumEqual("mmol/L", "mmol.L-1"); // => true
ucumEqual("mg", "g"); // => false