Options
All
  • Public
  • Public/Protected
  • All
Menu

A dense monetary value.

Dense values can represent arbitrary fractions of currency units.

Dense instances are immutable.

const a = Dense.fromDecimal("1.337", "EUR");
const b = Dense.fromDecimal("1.337", "USD");

a.add(b); // type error, USD is not assignable to EUR

Type parameters

  • Currency: string

Hierarchy

  • Dense

Index

Properties

Readonly currency

currency: Currency

Readonly value

value: Rational

Methods

add

div

mul

sub

toDecimal

  • toDecimal(): string

toNumber

  • toNumber(): number

Static fromDecimal

  • fromDecimal<T>(value: string, currency: T): Dense<T>
  • Type parameters

    • T: string

    Parameters

    • value: string
    • currency: T

    Returns Dense<T>

Static nat

  • nat<T>(value: bigint | number, currency: T): Dense<T>
  • Type parameters

    • T: string

    Parameters

    • value: bigint | number
    • currency: T

    Returns Dense<T>

Static of

Legend

Generated using TypeDoc