UNPKG

@formatjs/ecma402-abstract

Version:

A collection of implementation for ECMAScript abstract operations

13 lines (12 loc) 581 B
import { Decimal } from "@formatjs/bigdecimal"; /** * Cached function to compute powers of 10 for Decimal.js operations. * This cache significantly reduces overhead in ComputeExponent and ToRawFixed * by memoizing expensive Decimal.pow(10, n) calculations. * * Common exponents (e.g., -20 to 20) are used repeatedly in number formatting, * so caching provides substantial performance benefits. * * @param exponent - Can be a number or Decimal. If Decimal, it will be converted to string for cache key. */ export declare const getPowerOf10: (exponent: number | Decimal) => Decimal;