(value: unknown)
| 177 | |
| 178 | |
| 179 | export function resolveElements(value: unknown): HTMLElement[] | null { |
| 180 | |
| 181 | // do not call a function, unless it's a signal (to prevent creating new nodes) |
| 182 | if (typeof value === 'function' && !value.length && value.name === 'bound readSignal') { |
| 183 | return resolveElements(value()) |
| 184 | } |
| 185 | |
| 186 | if (Array.isArray(value)) { |
| 187 | const results: HTMLElement[] = [] |
| 188 | for (const item of value) { |
| 189 | const result = resolveElements(item) |
| 190 | if (result) |
| 191 | Array.isArray(result) ? results.push.apply(results, result) : results.push(result) |
| 192 | } |
| 193 | return results.length ? results : null |
| 194 | } |
| 195 | |
| 196 | return value instanceof HTMLElement ? [value] : null |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * helper to getting to an owner that you want — walking downwards |
nothing calls this directly
no test coverage detected
searching dependent graphs…