(library: any, paths: string[])
| 28 | } |
| 29 | |
| 30 | export 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 | |
| 60 | function findComponent(libraryMap: LibraryMap, componentName: string, npm?: IPublicTypeNpmInfo) { |
| 61 | if (!npm) { |
no outgoing calls
no test coverage detected
searching dependent graphs…