MCPcopy Index your code
hub / github.com/simstudioai/sim / safeAssign

Function safeAssign

apps/sim/tools/safe-assign.ts:14–25  ·  view source on GitHub ↗
(target: T, source: Record<string, unknown>)

Source from the content-addressed store, hash-verified

12 * Use this instead of Object.assign() when the source may contain user-controlled data.
13 */
14export function safeAssign<T extends object>(target: T, source: Record<string, unknown>): T {
15 if (!source || typeof source !== 'object') {
16 return target
17 }
18
19 for (const key of Object.keys(source)) {
20 if (isSafeKey(key)) {
21 ;(target as Record<string, unknown>)[key] = source[key]
22 }
23 }
24 return target
25}

Callers 6

createLLMToolSchemaFunction · 0.90
scrape.tsFile · 0.90
add_contact.tsFile · 0.90
buildLegacyStarterOutputFunction · 0.90

Calls 1

isSafeKeyFunction · 0.85

Tested by

no test coverage detected