export const WhiteSpace = {
  remove: (value: string): string => {
    return value.replace(/\s/g, "");
  },

  check: (value: string): boolean => {
    return /\s/.test(value);
  }
};

export const isNumeric = (value: string): boolean => {
  return /^\d+$/.test(value);
};

export const attachZero = (value: string | number): string => {
  let strValue = value.toString();

  if (!isNumeric(strValue)) {
    return strValue;
  }

  if (strValue.length === 1) {
    return "0" + value;
  }

  return strValue;
};

export const maskTelephone = (telephone: string): string => {
  const replaceTarget = telephone.substr(1, telephone.length - 3);
  let replaceValue = "";
  for (let i = 0; i < telephone.length - 3; i++) {
    replaceValue += "*";
  }

  return telephone.replace(replaceTarget, replaceValue);
};
