跳到主要内容

flywave-map-controls.safeparsedecimalint

Home > @flywave/flywave-map-controls > safeParseDecimalInt

safeParseDecimalInt() function

Safely parses decimal value into number.

Safely falls back to default value for null, undefined, NaN, empty strings, and strings with characters other than digits.

Signature:

export declare function safeParseDecimalInt(text: string | null | undefined, fallback: number): number;

Parameters

Parameter

Type

Description

text

string | null | undefined

Number as a text to be parsed.

fallback

number

Default value, which is returned if text doesn't represent a valid number.

Returns:



number