Files
klz-cables.com/.pnpm-store/v10/files/43/33264431aaeca6491bd1722d0239b7066e14fc902a5c453cbc2d6ba9752e4801495da6f0bb428d149eb3daeb2354b54ec4e2beb3d26ec8afa58e50733b2bea
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

16 lines
636 B
Plaintext

import { Decimal } from "decimal.js";
import { memoize } from "@formatjs/fast-memoize";
/**
* 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 const getPowerOf10 = memoize((exponent) => {
return Decimal.pow(10, exponent);
});