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