@esri/calcite-components
Version:
Web Components for Esri's Calcite Design System.
35 lines (34 loc) • 1.45 kB
TypeScript
import { NumberStringFormat } from "./locale";
export declare class BigDecimal {
value: bigint;
isNegative: boolean;
static DECIMALS: number;
static ROUNDED: boolean;
static SHIFT: bigint;
constructor(input: string | BigDecimal);
static _divRound: (dividend: bigint, divisor: bigint) => BigDecimal;
static fromBigInt: (bigint: bigint) => BigDecimal;
getIntegersAndDecimals(): {
integers: string;
decimals: string;
};
toString(): string;
formatToParts(formatter: NumberStringFormat): Intl.NumberFormatPart[];
format(formatter: NumberStringFormat): string;
add(n: string): BigDecimal;
subtract(n: string): BigDecimal;
multiply(n: string): BigDecimal;
divide(n: string): BigDecimal;
}
export declare function isValidNumber(numberString: string): boolean;
export declare function parseNumberString(numberString?: string): string;
export declare const sanitizeNumberString: (numberString: string) => string;
export declare function sanitizeExponentialNumberString(numberString: string, func: (s: string) => string): string;
/**
* Converts an exponential notation numberString into decimal notation.
* BigInt doesn't support exponential notation, so this is required to maintain precision
*
* @param {string} numberString - pre-validated exponential or decimal number
* @returns {string} numberString in decimal notation
*/
export declare function expandExponentialNumberString(numberString: string): string;