type PercentageOptions = { showDecimal?: boolean; decimalDigits?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; }; export declare class Percentage { private _rate; private _options; constructor(_rate: number, options?: PercentageOptions); /** * Get the decimal part of the percentage * @example * const value = new Percentage(45.63537383); * console.log(value.decimal); // 0.63537383 */ get decimal(): number; [Symbol.toPrimitive](hint: string): number | string; /** * Show the percentage representation of the percentage number. By default it will show the decimal digits, but you can turn that off with the options. * @param options PercentageOptions {showDecimal: true, decimalDigits: 2} is default * @returns string * @example * const value = new Percentage(45.63537383); * console.log(value.toString()); // 45.64% * console.log(value.toString({ decimalDigits: 1 })); // 45.6% * console.log(value.toString({ showDecimal: false })); // 46% * */ toString(options?: PercentageOptions): string; /** * Show the valueOf the percentage as a number. By default it will show the decimal digits, but you can turn that off with the options. * @param options PercentageOptions {showDecimal: true, decimalDigits: 2} is default * @returns number */ valueOf(options?: PercentageOptions): number; /** * The raw uneditted value as it is stored in the object. * @returns number */ numeric(): number; /** * Create a percentage from a numerator and denimator and return a new Percentage object. * @param numerator number the top half of the percentage calculation * @param denimator number the bottom half of the percentage calculation * @returns New Percentage Object * @example * const value = Percentage.from(45, 100); * console.log(value.valueOf()); // 45 * console.log(value.toString()); // 45% */ static from(numerator: number, denimator: number): Percentage; /** * True true or false if the percentage has a decimal part or not. * @returns boolean */ hasDecimal(): boolean; } export declare const percentage: (value: number) => Percentage; export {}; //# sourceMappingURL=Percentage.d.ts.map