export const maskPhone = (value) => {
  const text = String(value ?? '').trim();
  if (!text) return '';

  if (/^1\d{10}$/.test(text)) {
    return `${text.slice(0, 3)}****${text.slice(7)}`;
  }

  return text;
};

export const maskPhonesInText = (value) => {
  const text = String(value ?? '');
  if (!text) return '';

  return text.replace(/1\d{10}/g, (phone) => maskPhone(phone));
};
