UNPKG

number-as-string

Version:

Precise number scaling and formatting without JavaScript floating-point precision issues

16 lines 636 B
/** * Converts a number or string to a scaled number string with the specified number of decimal places. * * @param value - The number or string to convert. * @param decimals - The number of decimal places to include in the scaled number string. * @returns The scaled number string. * * @example * scaleUp("0.000000001", 18) // "1000000000" * // 0.000000001 * 10 ** 18 = 1000000000.0000001 * scaleUp(1.23456789, 2) // "123" * scaleUp(1, 18) // "1" + "0".repeat(18) * scaleUp(0.000000001, 18) // "1" */ export declare function scaleUp(value: number | string, decimals: number): string; //# sourceMappingURL=scale-up.d.ts.map