(props: any, nodeId: string)
| 99 | } |
| 100 | |
| 101 | function getNodeSchemaFromPropsById(props: any, nodeId: string): IPublicTypeNodeSchema | undefined { |
| 102 | let found: IPublicTypeNodeSchema | undefined; |
| 103 | for (const [_key, value] of Object.entries(props)) { |
| 104 | if (isJSSlot(value)) { |
| 105 | // value 是数组类型 { type: 'JSSlot', value: IPublicTypeNodeSchema[] } |
| 106 | if (Array.isArray(value.value)) { |
| 107 | for (const child of value.value) { |
| 108 | found = getNodeSchemaById(child as IPublicTypeNodeSchema, nodeId); |
| 109 | if (found) return found; |
| 110 | } |
| 111 | } |
| 112 | // value 是对象类型 { type: 'JSSlot', value: IPublicTypeNodeSchema } |
| 113 | found = getNodeSchemaById(value.value as IPublicTypeNodeSchema, nodeId); |
| 114 | if (found) return found; |
| 115 | } else if (isPlainObject(value)) { |
| 116 | found = getNodeSchemaFromPropsById(value, nodeId); |
| 117 | if (found) return found; |
| 118 | } |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * TODO: not sure if this is used anywhere |
no test coverage detected
searching dependent graphs…