Skip to content

@swapped/connect-sdk / core / sanitizeAmountInput

Function: sanitizeAmountInput() ​

sanitizeAmountInput(value, options?): string

Defined in: src/modules/amount-input/amount-input.utils.ts:24

Sanitize a decimal amount input string while typing.

Amount input sanitizer: commas become dots, complete scientific notation is expanded to a plain decimal (1e-7 → 0.0000001), non-numeric characters are stripped, a leading . becomes 0., extra dots collapse into the fraction, leading zeros on the integer part are stripped, and the fraction is truncated to maxDecimals when set.

Parameters ​

value ​

string

options? ​

SanitizeAmountInputOptions = {}

Returns ​

string