MCPcopy
hub / github.com/streamlit/streamlit / getElementId

Function getElementId

frontend/lib/src/util/utils.ts:397–407  ·  view source on GitHub ↗
(element: Element)

Source from the content-addressed store, hash-verified

395 * If the element has a valid ID, returns it. Otherwise, returns undefined.
396 */
397export function getElementId(element: Element): string | undefined {
398 const elementId = get(element as unknown as Record<string, unknown>, [
399 requireNonNull(element.type),
400 "id",
401 ])
402 if (elementId && isValidElementId(elementId)) {
403 // We only care about valid element IDs (with the correct prefix)
404 return elementId
405 }
406 return undefined
407}
408
409/** True if the given form ID is non-null and non-empty. */
410export function isValidFormId(formId?: string): formId is string {

Callers 5

visitElementNodeMethod · 0.90
utils.test.tsFile · 0.90
AppClass · 0.90

Calls 3

requireNonNullFunction · 0.85
isValidElementIdFunction · 0.85
getFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…