export const isValidInput = (inputValue: string, type: 'number' | 'text'): boolean => {
  if (inputValue.length !== 1) return false

  switch (type) {
    case 'number': {
      return /^\d$/.test(inputValue)
    }
    default: {
      return /^.$/.test(inputValue)
    }
  }
}

export const extractValidChars = (text: string, type: 'number' | 'text'): string => {
  switch (type) {
    case 'number': {
      return text.replaceAll(/\D/g, '')
    }
    default: {
      return text
    }
  }
}
