format-input.js 170 B

1234567
  1. const LEAD_ZERO = /^0+/;
  2. const NOT_NUMBERS = /[^\d]/g;
  3. export const formatInput = (input) => {
  4. return input.value.replace(NOT_NUMBERS, ``).replace(LEAD_ZERO, ``);
  5. };