Skip to content

Commit 2ea3e0e

Browse files
refactor(web): simplified regex
1 parent f80027e commit 2ea3e0e

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

web/src/utils/commify.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
export function commify(value: string | number): string {
22
const comps = String(value).split(".");
33

4-
if (
5-
comps.length > 2 ||
6-
!comps[0].match(/^-?[0-9]*$/) ||
7-
(comps[1] && !comps[1].match(/^[0-9]*$/)) ||
8-
value === "." ||
9-
value === "-."
10-
) {
4+
if (!String(value).match(/^-?[0-9]*\.?[0-9]*$/)) {
115
return "0";
126
}
137

0 commit comments

Comments
 (0)