MCPcopy Create free account
hub / github.com/chakra-ui/panda / processComponentObjectLike

Function processComponentObjectLike

packages/extractor/src/extract.ts:76–94  ·  view source on GitHub ↗
(
    component: Component,
    boxByProp: Map<string, BoxNode[]>,
    propNode: Node,
    objLike: BoxNodeMap | BoxNodeObject,
    matchProp: (prop: MatchPropArgs) => boolean,
    trackSpreadConditions = false,
  )

Source from the content-addressed store, hash-verified

74 }
75
76 const processComponentObjectLike = (
77 component: Component,
78 boxByProp: Map<string, BoxNode[]>,
79 propNode: Node,
80 objLike: BoxNodeMap | BoxNodeObject,
81 matchProp: (prop: MatchPropArgs) => boolean,
82 trackSpreadConditions = false,
83 ) => {
84 if (trackSpreadConditions && box.isMap(objLike) && objLike.spreadConditions?.length) {
85 component.conditionals.push(...objLike.spreadConditions)
86 }
87
88 const mapValue = objectLikeToMap(objLike, propNode)
89 mapValue.forEach((propValue, propName) => {
90 if (matchProp({ propName, propNode: propNode as any })) {
91 addComponentProp(component, boxByProp, propName, propValue)
92 }
93 })
94 }
95
96 const processComponentBoxNode = (
97 component: Component,

Callers 1

processComponentBoxNodeFunction · 0.85

Calls 4

objectLikeToMapFunction · 0.90
matchPropFunction · 0.85
addComponentPropFunction · 0.85
forEachMethod · 0.80

Tested by

no test coverage detected