+6
-0
| **2.4.2 / 2026-08-14** | ||
| - fix: trimZeros to avoid quadratic complexity | ||
| **2.4.1 / 2026-06-18** | ||
| - deps: update anynum to 1.0.1 | ||
| **2.4.0 / 2026-06-09** | ||
@@ -3,0 +9,0 @@ - support unicode numerals using 'anynum' |
+1
-1
| { | ||
| "name": "strnum", | ||
| "version": "2.4.1", | ||
| "version": "2.4.2", | ||
| "description": "Parse String to Number based on configuration", | ||
@@ -5,0 +5,0 @@ "type": "module", |
+5
-1
@@ -131,3 +131,7 @@ const hexRegex = /^[-+]?0x[a-fA-F0-9]+$/; | ||
| if (numStr && numStr.indexOf(".") !== -1) {//float | ||
| numStr = numStr.replace(/0+$/, ""); //remove ending zeros | ||
| //remove ending zeros without the O(n^2) backtracking that /0+$/ hits | ||
| //when the string doesn't end in 0 but has a long internal zero-run | ||
| let end = numStr.length; | ||
| while (end > 0 && numStr.charCodeAt(end - 1) === 48 /* '0' */) end--; | ||
| numStr = numStr.slice(0, end); | ||
| if (numStr === ".") numStr = "0"; | ||
@@ -134,0 +138,0 @@ else if (numStr[0] === ".") numStr = "0" + numStr; |
14551
2.57%158
2.6%