Skip to main content

DenominatedNumber

Defined in: packages/utils/src/denominated-number.ts:1

Extends

  • Number

Constructors

Constructor

new DenominatedNumber(
planck,
decimals,
denomination?): DenominatedNumber;

Defined in: packages/utils/src/denominated-number.ts:7

Parameters

ParameterType
planckstring | number | bigint | boolean
decimalsnumber
denomination?string

Returns

DenominatedNumber

Overrides

Number.constructor

Properties

decimals

readonly decimals: number;

Defined in: packages/utils/src/denominated-number.ts:9


denomination?

readonly optional denomination: string;

Defined in: packages/utils/src/denominated-number.ts:10


mapFromNumber()

mapFromNumber: (mapper) => DenominatedNumber;

Defined in: packages/utils/src/denominated-number.ts:139

Parameters

ParameterType
mapper(number) => number

Returns

DenominatedNumber

Deprecated

Use DenominatedNumber.mapNumber instead.


mapFromPlanck()

mapFromPlanck: (mapper) => DenominatedNumber;

Defined in: packages/utils/src/denominated-number.ts:126

Parameters

ParameterType
mapper(planck) => bigint

Returns

DenominatedNumber

Deprecated

Use DenominatedNumber.mapPlanck instead.


planck

readonly planck: bigint;

Defined in: packages/utils/src/denominated-number.ts:5


EPSILON

readonly static EPSILON: number;

Defined in: node_modules/typescript/lib/lib.es2015.core.d.ts:219

The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 that is representable as a Number value, which is approximately: 2.2204460492503130808472633361816 x 10‍−‍16.

Inherited from

Number.EPSILON

MAX_SAFE_INTEGER

readonly static MAX_SAFE_INTEGER: number;

Defined in: node_modules/typescript/lib/lib.es2015.core.d.ts:254

The value of the largest integer n such that n and n + 1 are both exactly representable as a Number value. The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1.

Inherited from

Number.MAX_SAFE_INTEGER

MAX_VALUE

readonly static MAX_VALUE: number;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:594

The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308.

Inherited from

Number.MAX_VALUE

MIN_SAFE_INTEGER

readonly static MIN_SAFE_INTEGER: number;

Defined in: node_modules/typescript/lib/lib.es2015.core.d.ts:261

The value of the smallest integer n such that n and n − 1 are both exactly representable as a Number value. The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)).

Inherited from

Number.MIN_SAFE_INTEGER

MIN_VALUE

readonly static MIN_VALUE: number;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:597

The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324.

Inherited from

Number.MIN_VALUE

NaN

readonly static NaN: number;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:603

A value that is not a number. In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function.

Inherited from

Number.NaN

NEGATIVE_INFINITY

readonly static NEGATIVE_INFINITY: number;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:609

A value that is less than the largest negative number that can be represented in JavaScript. JavaScript displays NEGATIVE_INFINITY values as -infinity.

Inherited from

Number.NEGATIVE_INFINITY

POSITIVE_INFINITY

readonly static POSITIVE_INFINITY: number;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:615

A value greater than the largest number that can be represented in JavaScript. JavaScript displays POSITIVE_INFINITY values as infinity.

Inherited from

Number.POSITIVE_INFINITY

Methods

mapNumber()

mapNumber(mapper): DenominatedNumber;

Defined in: packages/utils/src/denominated-number.ts:128

Parameters

ParameterType
mapper(number) => number

Returns

DenominatedNumber


mapPlanck()

mapPlanck(mapper): DenominatedNumber;

Defined in: packages/utils/src/denominated-number.ts:115

Parameters

ParameterType
mapper(planck) => bigint

Returns

DenominatedNumber


toExponential()

toExponential(fractionDigits?): string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:576

Returns a string containing a number represented in exponential notation.

Parameters

ParameterTypeDescription
fractionDigits?numberNumber of digits after the decimal point. Must be in the range 0 - 20, inclusive.

Returns

string

Inherited from

Number.toExponential

toFixed()

toFixed(fractionDigits?): string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:570

Returns a string representing a number in fixed-point notation.

Parameters

ParameterTypeDescription
fractionDigits?numberNumber of digits after the decimal point. Must be in the range 0 - 20, inclusive.

Returns

string

Inherited from

Number.toFixed

toLocaleString()

Call Signature

toLocaleString(locales?, options?): string;

Defined in: packages/utils/src/denominated-number.ts:87

Converts a number to a string by using the current or specified locale.

Parameters
ParameterTypeDescription
locales?string | string[]A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
options?NumberFormatOptionsAn object that contains one or more properties that specify comparison options.
Returns

string

Overrides
Number.toLocaleString

Call Signature

toLocaleString(locales?, options?): string;

Defined in: packages/utils/src/denominated-number.ts:91

Converts a number to a string by using the current or specified locale.

Parameters
ParameterTypeDescription
locales?LocalesArgumentA locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
options?NumberFormatOptionsAn object that contains one or more properties that specify comparison options.
Returns

string

Overrides
Number.toLocaleString

toPrecision()

toPrecision(precision?): string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:582

Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits.

Parameters

ParameterTypeDescription
precision?numberNumber of significant digits. Must be in the range 1 - 21, inclusive.

Returns

string

Inherited from

Number.toPrecision

toString()

toString(): string;

Defined in: packages/utils/src/denominated-number.ts:71

Returns a string representation of an object.

Returns

string

Overrides

Number.toString

valueOf()

valueOf(): number;

Defined in: packages/utils/src/denominated-number.ts:67

Returns the primitive value of the specified object.

Returns

number

Overrides

Number.valueOf

fromNumber()

static fromNumber(
number,
decimals,
denomination?): DenominatedNumber;

Defined in: packages/utils/src/denominated-number.ts:16

Parameters

ParameterType
numberstring | number
decimalsnumber
denomination?string

Returns

DenominatedNumber


isFinite()

static isFinite(number): boolean;

Defined in: node_modules/typescript/lib/lib.es2015.core.d.ts:227

Returns true if passed value is finite. Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a number. Only finite values of the type number, result in true.

Parameters

ParameterTypeDescription
numberunknownA numeric value.

Returns

boolean

Inherited from

Number.isFinite

isInteger()

static isInteger(number): boolean;

Defined in: node_modules/typescript/lib/lib.es2015.core.d.ts:233

Returns true if the value passed is an integer, false otherwise.

Parameters

ParameterTypeDescription
numberunknownA numeric value.

Returns

boolean

Inherited from

Number.isInteger

isNaN()

static isNaN(number): boolean;

Defined in: node_modules/typescript/lib/lib.es2015.core.d.ts:241

Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter to a number. Only values of the type number, that are also NaN, result in true.

Parameters

ParameterTypeDescription
numberunknownA numeric value.

Returns

boolean

Inherited from

Number.isNaN

isSafeInteger()

static isSafeInteger(number): boolean;

Defined in: node_modules/typescript/lib/lib.es2015.core.d.ts:247

Returns true if the value passed is a safe integer.

Parameters

ParameterTypeDescription
numberunknownA numeric value.

Returns

boolean

Inherited from

Number.isSafeInteger

parseFloat()

static parseFloat(string): number;

Defined in: node_modules/typescript/lib/lib.es2015.core.d.ts:267

Converts a string to a floating-point number.

Parameters

ParameterTypeDescription
stringstringA string that contains a floating-point number.

Returns

number

Inherited from

Number.parseFloat

parseInt()

static parseInt(string, radix?): number;

Defined in: node_modules/typescript/lib/lib.es2015.core.d.ts:276

Converts A string to an integer.

Parameters

ParameterTypeDescription
stringstringA string to convert into a number.
radix?numberA value between 2 and 36 that specifies the base of the number in string. If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. All other strings are considered decimal.

Returns

number

Inherited from

Number.parseInt