Skip to main content
Version: v0.0.4

Function: parseUcum()

parseUcum(unit): ParseResult

Parse a UCUM unit expression into an AST.

Parameters

unit

string

The unit expression (e.g. "mmol/L", "kg.m/s2", "10*3/ul").

Returns

ParseResult

The parsed UnitNode, or a typed ParseFailure with a value-free reason.

Example

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

parseUcum("mmol/L").ok; // => true
parseUcum("m/").ok; // => false