MCPcopy Create free account
hub / github.com/primer/react / getItemById

Function getItemById

packages/react/src/Autocomplete/AutocompleteMenu.tsx:44–46  ·  view source on GitHub ↗
(itemId: string, items: T[])

Source from the content-addressed store, hash-verified

42const isItemSelected = (itemId: string, selectedItemIds: Array<string>) => selectedItemIds.includes(itemId)
43
44function getItemById<T extends AutocompleteMenuItem>(itemId: string, items: T[]) {
45 return items.find(item => item.id === itemId)
46}
47
48// eslint-disable-next-line @typescript-eslint/no-explicit-any
49type AutocompleteItemProps<T = Record<string, any>> = AutocompleteMenuItem & {metadata?: T}

Callers 1

AutocompleteMenuFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected