MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / findById

Function findById

packages/sdk/src/engine/model.ts:31–38  ·  view source on GitHub ↗
(document: Document, id: string)

Source from the content-addressed store, hash-verified

29// ─── Element lookup ───────────────────────────────────────────────────────────
30
31export function findById(document: Document, id: string): Element | null {
32 // Delegate to resolveScoped so patch replay (undo/redo, override-set apply)
33 // resolves an id the SAME way forward dispatch does: canonical-first for an
34 // ambiguous bare id, and scoped-path ("hf-host/hf-leaf") aware. Otherwise the
35 // two paths disagree on which duplicate a bare id targets and undo reverts the
36 // wrong element. (function declaration is hoisted.)
37 return resolveScoped(document, id);
38}
39
40export function escapeHfId(id: string): string {
41 return id.replace(/\\/g, "\\\\").replace(/"/g, '\\"');

Callers 2

applyOneFunction · 0.70

Calls 1

resolveScopedFunction · 0.85

Tested by

no test coverage detected