find method ✓ 100.0%

Last updated: 2026-02-24T19:46:21.779Z

Metrics

LOC: 16 Complexity: 6 Params: 1 Coverage: 100.0% (9/9 lines, 72x executed)

Signature

find(element: HTMLElement): : LabelResult | null

Source Code

  find(element: HTMLElement): LabelResult | null {
    let sibling: Element | null = element.previousElementSibling;

    while (sibling) {
      const tag = sibling.tagName.toLowerCase();
      if (LABEL_LIKE_TAGS.has(tag) && sibling.textContent) {
        const text = sibling.textContent.trim();
        if (text.length > 0 && text.length < 80) {
          return { text, strategy: "prev-sibling-text" };
        }
      }
      sibling = sibling.previousElementSibling;
    }

    return null;
  },

Dependencies (Outgoing)

graph LR find["find"] LabelResult["LabelResult"] LabelStrategy["LabelStrategy"] find -->|uses| LabelResult find -->|uses| LabelStrategy style find fill:#dbeafe,stroke:#2563eb,stroke-width:2px click find "82babc9211101cc3.html" click LabelResult "476761065111ae2f.html" click LabelStrategy "838d971bd28eb15e.html"
TargetType
LabelResult uses
LabelStrategy uses

No incoming dependencies.