MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / resolveElements

Function resolveElements

packages/debugger/src/main/utils.ts:179–197  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

177
178
179export 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

Callers

nothing calls this directly

Calls 1

valueFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…