@bee-design/ui
Version:
Bee Design React UI Library.
32 lines (31 loc) • 966 B
TypeScript
export declare class Decimal {
origin: string;
isNegative: boolean;
isEmpty: boolean;
isNaN: boolean;
integer: bigint;
decimal: bigint;
decimalLen: number;
static from(value: string | number): Decimal;
constructor(value: string | number);
get isInvalid(): boolean;
get mark(): "" | "-";
get integerStr(): string;
get decimalStr(): string;
private alignDecimal;
negate(): Decimal;
add(value: string | number): Decimal;
equals(target: Decimal): boolean;
less(target: Decimal): boolean;
toNumber(): number;
toString(options?: {
safe: boolean;
precision?: number;
}): string;
/**
* Replace String.prototype.toFixed like Math.round
* If cutOnly is true, just slice the tail
* e.g. Decimal.toFixed(0.15) will return 0.2, not 0.1
*/
static toFixed(numStr: string, precision?: number, cutOnly?: boolean): string;
}