Yuliya Shatokhina 4 жил өмнө
parent
commit
272d9b9c52

+ 7 - 0
js/utils/format-input.js

@@ -0,0 +1,7 @@
+const LEAD_ZERO = /^0+/;
+const NOT_NUMBERS = /[^\d]/g;
+
+
+export const formatInput = (input) => {
+  return input.value.replace(NOT_NUMBERS, ``).replace(LEAD_ZERO, ``);
+};