Skip to content

@swapped/connect-sdk / core / sanitizeAmountInput

Function: sanitizeAmountInput()

sanitizeAmountInput(value, options?): string

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

Sanitize a decimal amount input string while typing.

Amount input sanitizer: commas become dots, 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