Spaces:
Sleeping
Sleeping
File size: 321 Bytes
c40c75a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
export function updateExistingKeys<Source extends Object>(
target: Source,
source: Object
): Source {
const clonedTarget = structuredClone(target);
for (const [key, value] of Object.entries(source)) {
if (key in clonedTarget) {
(clonedTarget as any)[key] = value;
}
}
return clonedTarget;
}
|