export const toSnakeCase = (text: string) => {
  const lowercaseText = text.toLowerCase();

  // Reemplazar paréntesis con una cadena vacía
  const textWithoutParentheses = lowercaseText.replace(/[()]/g, '');

  const words = textWithoutParentheses.split(' ');
  const snakeCaseText = words.map((word) => {
    return word.replace(/^[A-Z]/, (letter) => {
      return word[0] !== '_' && word[0] !== '-' ? `${letter}_` : letter;
    });
  });

  const noAndSnakeCaseText = snakeCaseText.map((word) => {
    return word.replace('&', '');
  });

  const noCommaOrCloseBraceSnakeCaseText = noAndSnakeCaseText.map((word) => {
    return word.replace(',', '');
  });

  return noCommaOrCloseBraceSnakeCaseText.join('-');
};
