src/lib/form/extractors/strategies/title.ts

Total Symbols
1
Lines of Code
17
Avg Complexity
2.0
Avg Coverage
100.0%

Symbols by Kind

method 1

All Symbols

Name Kind Visibility Status Lines Signature
find method - 11-15 find(element: HTMLElement): : LabelResult | null

Full Source

/**
 * Label Strategy — title
 *
 * Reads the HTML `title` attribute.
 */

import type { LabelResult, LabelStrategy } from "../label-strategy.interface";

export const titleStrategy: LabelStrategy = {
  name: "title",
  find(element: HTMLElement): LabelResult | null {
    const title = element.getAttribute("title");
    const text = title?.trim();
    return text ? { text, strategy: "title" } : null;
  },
};