Skip to main content
Version: v0.0.4

Function: reduce()

reduce(node): Reduction

Reduce a parsed UCUM unit to its canonical Reduction - a linear scalar×dimension form, or an opaque special form for expressions involving a non-linear special unit.

Parameters

node

UnitNode

The AST from parseUcum.

Returns

Reduction

The reduced form.

Example

import { parseUcum, reduce } from "@cosyte/terminology";

const parsed = parseUcum("N");
if (parsed.ok) {
const r = reduce(parsed.node);
r.kind; // => "linear" (1000 × g·m·s⁻²)
}