MCPcopy
hub / github.com/streamlit/streamlit / isValidElementId

Function isValidElementId

frontend/lib/src/util/utils.ts:381–392  ·  view source on GitHub ↗
(
  elementId: string | undefined | null
)

Source from the content-addressed store, hash-verified

379}
380
381export function isValidElementId(
382 elementId: string | undefined | null
383): boolean {
384 if (!elementId) {
385 return false
386 }
387 return (
388 elementId.startsWith(GENERATED_ELEMENT_ID_PREFIX) &&
389 // There must be at least 3 parts: $$ID-<hash>-<userKey>
390 elementId.split("-").length >= 3
391 )
392}
393
394/**
395 * If the element has a valid ID, returns it. Otherwise, returns undefined.

Callers 3

getKeyFromIdFunction · 0.90
utils.test.tsFile · 0.90
getElementIdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…