• Convert a DEM amount (human-readable) to an OS amount (smallest unit).

    Accepts number or string for ergonomics. The result is always a bigint. Strings are preferred for high-precision input because JavaScript number cannot represent every 9-decimal value exactly.

    Throws if:

    • The input has more than OS_DECIMALS fractional digits.
    • The resulting amount is negative.

    Parameters

    • dem: string | number

      DEM amount as number or decimal string.

    Returns bigint

    OS amount as bigint.

    demToOs(1)            // => 1_000_000_000n
    
    demToOs("0.5")        // => 500_000_000n
    
    demToOs(100)          // => 100_000_000_000n
    
    demToOs("1.123456789")// => 1_123_456_789n