MCPcopy
hub / github.com/cloudflare/capnweb / applyMapToElement

Function applyMapToElement

src/map.ts:301–313  ·  view source on GitHub ↗
(input: unknown, parent: object | undefined, owner: RpcPayload | null,
                           captures: StubHook[], instructions: unknown[])

Source from the content-addressed store, hash-verified

299}
300
301function applyMapToElement(input: unknown, parent: object | undefined, owner: RpcPayload | null,
302 captures: StubHook[], instructions: unknown[]): RpcPayload {
303 // TODO(perf): I wonder if we could use .fromAppParams() instead of .deepCopyFrom()? It
304 // maybe wouldn't correctly handle the case of RpcTargets in the input, so we need a variant
305 // which takes an `owner`, which does add some complexity.
306 let inputHook = new PayloadStubHook(RpcPayload.deepCopyFrom(input, parent, owner));
307 let mapper = new MapApplicator(captures, inputHook);
308 try {
309 return mapper.apply(instructions);
310 } finally {
311 mapper.dispose();
312 }
313}
314
315mapImpl.applyMap = (input: unknown, parent: object | undefined, owner: RpcPayload | null,
316 captures: StubHook[], instructions: unknown[]) => {

Callers 1

map.tsFile · 0.85

Calls 3

applyMethod · 0.95
disposeMethod · 0.95
deepCopyFromMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…