Cashu-TS - v3.7.2
    Preparing search index...

    Class Amount

    Immutable, non-negative integer amount value object.

    Internal representation is bigint. Use factory methods to instantiate.

    Amount.from('21'); // string
    Amount.from(21); // number
    Amount.from(21n); // bigint
    Amount.zero();
    Amount.one();
    Index

    Methods

    • Compares this Amount with another Amount.

      Defines the natural ordering of Amount values. Useful for sorting and ordering logic.

      Parameters

      Returns -1 | 0 | 1

      -1 if this < other, 0 if equal, 1 if this > other.

    • Whether this Amount can be safely converted to a number.

      Returns boolean

    • Safe conversion to number.

      Returns number

      If value exceeds Number.MAX_SAFE_INTEGER.

    • Unsafe conversion to number. Precision can be lost above MAX_SAFE_INTEGER.

      Returns number

    • Canonical decimal representation for logs/JSON string mode.

      Returns string