MCPcopy
hub / github.com/algolia/autocomplete / createSource

Function createSource

test/utils/createSource.ts:7–20  ·  view source on GitHub ↗
(
  source?: Partial<AutocompleteSource<TItem>>
)

Source from the content-addressed store, hash-verified

5} from '@algolia/autocomplete-core';
6
7export function createSource<TItem extends BaseItem>(
8 source?: Partial<AutocompleteSource<TItem>>
9): InternalAutocompleteSource<TItem> {
10 return {
11 sourceId: 'testSource',
12 getItemInputValue: ({ state }) => state.query,
13 getItemUrl: () => undefined,
14 onActive: () => {},
15 onSelect: () => {},
16 onResolve: () => {},
17 getItems: () => [],
18 ...source,
19 };
20}

Callers 15

getSourcesFunction · 0.90
getSourcesFunction · 0.90
getSourcesFunction · 0.90
getSourcesFunction · 0.90
getSourcesFunction · 0.90
getSources.test.tsFile · 0.90
getSourcesFunction · 0.90
debouncing.test.tsFile · 0.90
getSourcesFunction · 0.90

Calls

no outgoing calls

Tested by 10

getSourcesFunction · 0.72
getSourcesFunction · 0.72
getSourcesFunction · 0.72
getSourcesFunction · 0.72
getSourcesFunction · 0.72
getSourcesFunction · 0.72
getSourcesFunction · 0.72
delayedGetSourcesFunction · 0.72
getSourcesFunction · 0.72
getSourcesFunction · 0.72