MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / assign

Function assign

packages/hosts/mcp-apps-shell/src/shell/tools-proxy.ts:118–126  ·  view source on GitHub ↗
(target: unknown, [segment, ...rest]: readonly string[])

Source from the content-addressed store, hash-verified

116 // Recurse over the remaining segments rather than an index, so "the head
117 // exists" is a fact about the array rather than something to assert.
118 const assign = (target: unknown, [segment, ...rest]: readonly string[]): unknown => {
119 if (segment === undefined) return pageParam;
120 const record: Record<string, unknown> =
121 typeof target === "object" && target !== null && !Array.isArray(target)
122 ? { ...(target as Record<string, unknown>) }
123 : {};
124 record[segment] = rest.length === 0 ? pageParam : assign(record[segment], rest);
125 return record;
126 };
127
128 return assign(base, cursorKey.split("."));
129};

Callers 1

withCursorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected