Skip to main content
Version: v0.0.3

Function: checkUcumUnit()

checkUcumUnit(quantity, position, ctx): void

Validate a PQ's @unit with the computable UCUM grammar, emitting the appropriate Tier-2 warning: MISSING_UNIT_ON_PQ (numeric value, no unit), UCUM_CASE_SUSPECT (a letter-case slip of a canonical unit), or NON_UCUM_UNIT (not well-formed UCUM). The quantity itself is never mutated, the raw unit is always preserved.

Parameters

quantity

PQ

position

CcdaPosition

ctx

ParseCtx

Returns

void

Example

import { checkUcumUnit } from "@cosyte/ccda";
checkUcumUnit({ value: 5, unit: "cc" }, { path: "value" }, ctx);