MCPcopy Create free account
hub / github.com/alibaba/lowcode-engine / getSubComponent

Function getSubComponent

packages/utils/src/build-components.ts:30–58  ·  view source on GitHub ↗
(library: any, paths: string[])

Source from the content-addressed store, hash-verified

28}
29
30export function getSubComponent(library: any, paths: string[]) {
31 const l = paths.length;
32 if (l < 1 || !library) {
33 return library;
34 }
35 let i = 0;
36 let component: any;
37 while (i < l) {
38 const key = paths[i]!;
39 let ex: any;
40 try {
41 component = library[key] || component;
42 } catch (e) {
43 ex = e;
44 component = null;
45 }
46 if (i === 0 && component == null && key === 'default') {
47 if (ex) {
48 return l === 1 ? library : null;
49 }
50 component = library;
51 } else if (component == null) {
52 return null;
53 }
54 library = component;
55 i++;
56 }
57 return component;
58}
59
60function findComponent(libraryMap: LibraryMap, componentName: string, npm?: IPublicTypeNpmInfo) {
61 if (!npm) {

Callers 4

findComponentFunction · 0.85
getComponentMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…