(currentDeps: T | null, newDeps: T)
| 120 | * making sure that a dependency doesn't yet exist in the registry. |
| 121 | */ |
| 122 | export function addDepsToRegistry<T extends DependencyDef[]>(currentDeps: T | null, newDeps: T): T { |
| 123 | if (!currentDeps || currentDeps.length === 0) { |
| 124 | return newDeps; |
| 125 | } |
| 126 | |
| 127 | const currentDepSet = new Set(currentDeps); |
| 128 | for (const dep of newDeps) { |
| 129 | currentDepSet.add(dep); |
| 130 | } |
| 131 | |
| 132 | // If `currentDeps` is the same length, there were no new deps and can |
| 133 | // return the original array. |
| 134 | return currentDeps.length === currentDepSet.size ? currentDeps : (Array.from(currentDepSet) as T); |
| 135 | } |
| 136 | |
| 137 | /** Retrieves a TNode that represents main content of a defer block. */ |
| 138 | export function getPrimaryBlockTNode(tView: TView, tDetails: TDeferBlockDetails): TContainerNode { |
no test coverage detected
searching dependent graphs…