flattenEntries function presentation

Last updated: 2026-03-04T23:21:38.428Z

Metrics

LOC: 15 Complexity: 5 Params: 2

Signature

flattenEntries( entries: SelectEntry[], ): : Array<SelectOption & { groupLabel?: string }>

Summary

Builds a flat searchable list from entries

Source Code

function flattenEntries(
  entries: SelectEntry[],
): Array<SelectOption & { groupLabel?: string }> {
  const result: Array<SelectOption & { groupLabel?: string }> = [];
  for (const entry of entries) {
    if (isGroup(entry)) {
      for (const o of entry.options) {
        result.push({ ...o, groupLabel: entry.groupLabel });
      }
    } else {
      result.push(entry);
    }
  }
  return result;
}

Dependencies (Outgoing)

graph LR flattenEntries["flattenEntries"] isGroup["isGroup"] flattenEntries -->|calls| isGroup style flattenEntries fill:#dbeafe,stroke:#2563eb,stroke-width:2px click flattenEntries "da78fff9504489c0.html" click isGroup "78ccd159e2262e09.html"
TargetType
isGroup calls

Impact (Incoming)

graph LR flattenEntries["flattenEntries"] SearchableSelectPreactProps["SearchableSelectPreactProps"] constructor["constructor"] SearchableSelectPreactProps -->|calls| flattenEntries constructor -->|calls| flattenEntries style flattenEntries fill:#dbeafe,stroke:#2563eb,stroke-width:2px click flattenEntries "da78fff9504489c0.html" click SearchableSelectPreactProps "d7a485bb75ce909c.html" click constructor "84b2188bdf2643c4.html"
SourceType
SearchableSelectPreactProps calls
constructor calls