Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

280 B
Raw Blame
import Decimal from "decimal.js";

export const getMaxDecimals = (
  value: number | undefined,
  scaleMultiplier = 1,
) => {
  return (
    new Decimal(value ?? 0)
      .mul(scaleMultiplier)
      .toFixed(12)
      .split(".")[1]
      ?.replace(/0+$/, "").length ?? 0
  );
};