n2words
Version:
Convert numbers to words in 70+ languages with zero dependencies. Supports BigInt, decimals, and browser/Node.js environments.
29 lines (28 loc) • 1.17 kB
TypeScript
/**
* Scientific notation expansion utility.
* Converts scientific notation strings to full decimal form.
* @module expand-scientific
*/
/**
* Expands scientific notation to full decimal form.
* Handles arbitrarily large exponents without precision loss.
* @param {string} str - String in scientific notation (e.g., "1e21", "1.5e-3")
* @returns {string} Full decimal representation (e.g., "1000000000000000000000", "0.0015")
* @example
* expandScientificNotation("1e21") // "1000000000000000000000"
* expandScientificNotation("1.5e3") // "1500"
* expandScientificNotation("1e-3") // "0.001"
*/
export declare function expandScientificNotation(str: string): string;
/**
* Converts a number to decimal string, expanding scientific notation if needed.
* @param {number} value - The number to convert
* @returns {string} Decimal string representation
*/
export declare function numberToString(value: number): string;
/**
* Checks if a string contains scientific notation.
* @param {string} str - String to check
* @returns {boolean} True if string contains 'e' or 'E'
*/
export declare function hasScientificNotation(str: string): boolean;