MCPcopy Create free account
hub / github.com/ecomfe/tempad-dev / h

Function h

packages/plugins/src/index.ts:392–412  ·  view source on GitHub ↗
(
  name: string,
  propsOrChildren?: T | (DevComponent | string)[] | DevComponent | string,
  childrenOrSingle?: (DevComponent | string)[] | DevComponent | string
)

Source from the content-addressed store, hash-verified

390 children?: (DevComponent | string)[] | DevComponent | string
391): DevComponent<T>
392export function h<T extends object = Record<string, unknown>>(
393 name: string,
394 propsOrChildren?: T | (DevComponent | string)[] | DevComponent | string,
395 childrenOrSingle?: (DevComponent | string)[] | DevComponent | string
396): DevComponent<T> {
397 const props =
398 propsOrChildren === undefined || isChildrenArgument(propsOrChildren)
399 ? ({} as T)
400 : (propsOrChildren as T)
401
402 const childSource =
403 propsOrChildren === undefined || isChildrenArgument(propsOrChildren)
404 ? (propsOrChildren ?? childrenOrSingle)
405 : childrenOrSingle
406
407 return {
408 name,
409 props,
410 children: normalizeChildren(childSource)
411 }
412}
413
414// Mapped type for queryable properties
415type QueryableProperties = {

Callers 1

index.test.tsFile · 0.90

Calls 2

isChildrenArgumentFunction · 0.85
normalizeChildrenFunction · 0.85

Tested by

no test coverage detected