(leftPad?: string)
| 27 | } |
| 28 | |
| 29 | export const getRandom4Digits = (leftPad?: string): string => { |
| 30 | const random = Math.floor(1000 + Math.random() * 9000); |
| 31 | |
| 32 | if (!leftPad) { |
| 33 | return random.toString(); |
| 34 | } |
| 35 | |
| 36 | return random.toString().padStart(4, leftPad); |
| 37 | }; |
| 38 | |
| 39 | export const removeNonNumber = (value: string): string => |
| 40 | value.replace(/,(\d{2})$/, '.$1').replace(/[^\d.]/g, ''); |