/**
 * Removes `\n` and `\t` characters before closing tags (after text content).
 *
 * Transforms patterns like `(text)[\n\t]+<` to `(text)<`.
 *
 * Examples:
 * - `World\n\t</p>` → `World</p>`
 * - `Hello\n</div>` → `Hello</div>`
 */
export class RemoveWhitespaceBeforeClosingTagProcessor {
  /**
   * Process the HTML string to remove `\n` and `\t` before closing tags.
   *
   * @param {string} html - The HTML string to process.
   * @returns {string} The processed HTML string.
   */
  process(html) {
    // Pattern: `(text)[\n\t]+<` → `(text)<`
    return html.replace(/(.?)[\n\t]+(?=<)/g, '$1');
  }
}
