mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 17:08:03 +08:00
refactor(web): replace String.match() with RegExp.exec() for non-global regex (#32386)
This commit is contained in:
@ -39,7 +39,7 @@ export const formatNumber = (num: number | string) => {
|
||||
// Force fixed decimal for small numbers to avoid scientific notation
|
||||
if (Math.abs(n) < 0.001 && n !== 0) {
|
||||
const str = n.toString()
|
||||
const match = str.match(/e-(\d+)$/)
|
||||
const match = /e-(\d+)$/.exec(str)
|
||||
let precision: number
|
||||
if (match) {
|
||||
// Scientific notation: precision is exponent + decimal digits in mantissa
|
||||
|
||||
Reference in New Issue
Block a user