Skip to main content
Version: v0.0.3

Function: decimalValue()

decimalValue(raw): DecimalValue

Wrap a raw textual value as a DecimalValue without converting to a float. Invalid input is preserved as-is with isValid: false: lenient parse, never a throw.

Parameters

raw

string

The textual value from the message (already trimmed by the caller).

Returns

DecimalValue

A frozen DecimalValue.

Example

decimalValue("0.1").isValid; // true
decimalValue("1/2").isValid; // false (still preserved as source)