(element: Element)
| 395 | * If the element has a valid ID, returns it. Otherwise, returns undefined. |
| 396 | */ |
| 397 | export 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. */ |
| 410 | export function isValidFormId(formId?: string): formId is string { |
no test coverage detected
searching dependent graphs…