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

Function createElement

examples/vue/src/utils/createElement.js:3–20  ·  view source on GitHub ↗
(type, props, ...children)

Source from the content-addressed store, hash-verified

1import { h } from 'vue';
2
3export function createElement(type, props, ...children) {
4 const adaptedProps = Object.entries(props || {}).reduce(
5 (acc, [key, value]) => {
6 // Vue 3 accepts lower-case event names so we need to transform props like
7 // `onMouseMove` to `onMousemove`.
8 const property =
9 key[0] === 'o' && key[1] === 'n'
10 ? key.slice(0, 3) + key.slice(3).toLowerCase()
11 : key;
12
13 acc[property] = value;
14 return acc;
15 },
16 {}
17 );
18
19 return h(type, adaptedProps, ...children);
20}

Callers 15

HighlightFunction · 0.50
ReverseHighlightFunction · 0.50
SnippetFunction · 0.50
ReverseSnippetFunction · 0.50
renderFunction · 0.50
renderNoResultsFunction · 0.50
headerFunction · 0.50
itemFunction · 0.50
footerFunction · 0.50
noResultsFunction · 0.50
renderFunction · 0.50
itemFunction · 0.50

Calls

no outgoing calls

Tested by 10

renderFunction · 0.40
renderNoResultsFunction · 0.40
headerFunction · 0.40
itemFunction · 0.40
footerFunction · 0.40
noResultsFunction · 0.40
renderFunction · 0.40
itemFunction · 0.40
itemFunction · 0.40
itemFunction · 0.40