Skip to content

Commit c58b50b

Browse files
committed
fix(lib-dynamodb): check for function types in processKeys
1 parent 7841411 commit c58b50b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/lib-dynamodb/src/commands/utils.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,18 @@ const processKeysInObj = (obj: any, processFunc: Function, keyNodes: KeyNodeChil
6464
if (Array.isArray(obj)) {
6565
accumulator = [...obj];
6666
} else {
67-
accumulator = { ...obj };
67+
accumulator = {};
68+
for (const [k, v] of Object.entries(obj)) {
69+
if (typeof v !== "function") {
70+
accumulator[k] = v;
71+
}
72+
}
6873
}
6974

7075
for (const [nodeKey, nodes] of Object.entries(keyNodes)) {
76+
if (typeof obj[nodeKey] === "function") {
77+
continue;
78+
}
7179
const processedValue = processObj(obj[nodeKey], processFunc, nodes);
7280
if (processedValue !== undefined) {
7381
accumulator[nodeKey] = processedValue;
@@ -82,6 +90,9 @@ const processAllKeysInObj = (obj: any, processFunc: Function, keyNodes: KeyNodes
8290
return obj.map((item) => processObj(item, processFunc, keyNodes));
8391
}
8492
return Object.entries(obj).reduce((acc, [key, value]) => {
93+
if (typeof value === "function") {
94+
return acc;
95+
}
8596
const processedValue = processObj(value, processFunc, keyNodes);
8697
if (processedValue !== undefined) {
8798
acc[key] = processedValue;

0 commit comments

Comments
 (0)