( list: any[], appPath: string, featureCode?: string, name?: string )
| 50 | * 插件类型优先按 pluginName 匹配;direct/app 匹配 path + name。 |
| 51 | */ |
| 52 | export function filterOutCommand( |
| 53 | list: any[], |
| 54 | appPath: string, |
| 55 | featureCode?: string, |
| 56 | name?: string |
| 57 | ): any[] { |
| 58 | return list.filter((item) => { |
| 59 | if (item.type === 'plugin' && featureCode !== undefined) { |
| 60 | if (item.featureCode !== featureCode) { |
| 61 | return true |
| 62 | } |
| 63 | if (name && item.pluginName) { |
| 64 | return item.pluginName !== name |
| 65 | } |
| 66 | return item.path !== appPath |
| 67 | } |
| 68 | |
| 69 | if (isDirectApp(item, item?.type)) { |
| 70 | if (name) { |
| 71 | return !(item.path === appPath && item.name === name) |
| 72 | } |
| 73 | return item.path !== appPath |
| 74 | } |
| 75 | |
| 76 | if (name) { |
| 77 | return !(item.path === appPath && item.name === name) |
| 78 | } |
| 79 | return item.path !== appPath |
| 80 | }) |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * 检查列表中是否已存在匹配项(用于 pinApp) |
no test coverage detected