@maskito/kit
Version:
The optional framework-agnostic Maskito's package with ready-to-use masks
28 lines • 1.01 kB
TypeScript
/**
* Converts a number to a decimal string without using exponential notation.
*
* - Numbers without exponent are returned as-is.
* - Numbers with a positive exponent (`e+N`) are expanded using locale formatting.
* - Numbers with a negative exponent (`e-N`) are expanded manually to avoid
* precision limits of `Number#toFixed` and locale rounding.
*
* The sign of the number and the sign of the exponent are handled independently.
* This guarantees correct formatting for cases like `-1.23e-8`.
*
* @param value Number or bigint to convert.
* @returns Full decimal string representation without exponent notation.
*
* @example
* stringifyNumberWithoutExp(1e25)
* // "10000000000000000000000000"
*
* @example
* stringifyNumberWithoutExp(1.23e-8)
* // "0.0000000123"
*
* @example
* stringifyNumberWithoutExp(-1.23e-8)
* // "-0.0000000123"
*/
export declare function stringifyNumberWithoutExp(value: bigint | number): string;
//# sourceMappingURL=stringify-number-without-exp.d.ts.map