Skip to content

Commit

Permalink
fix: removed useless comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lugnicca committed Feb 10, 2025
1 parent ca35aed commit 7b894f5
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions packages/nodes-base/nodes/Aws/DynamoDB/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,23 @@ export function adjustExpressionAttributeName(eanUi: IAttributeNameUi[]) {
}

function convertToDynamoDBValue(value: unknown): DynamoDBAttributeValue {
// Handle null and undefined
if (value === null || value === undefined) {
return { NULL: true };
}

// Handle booleans
if (typeof value === 'boolean') {
return { BOOL: value };
}

// Handle numbers
if (typeof value === 'number') {
return { N: value.toString() };
}

// Handle arrays
if (Array.isArray(value)) {
if (value.length === 0) {
return { L: [] };
}

// Check if all elements are of the same type
const allStrings = value.every((item): item is string => typeof item === 'string');
const allNumbers = value.every((item): item is number => typeof item === 'number');

Expand All @@ -73,7 +68,6 @@ function convertToDynamoDBValue(value: unknown): DynamoDBAttributeValue {
return { L: value.map(convertToDynamoDBValue) };
}

// Handle objects (maps)
if (typeof value === 'object') {
const map: { [key: string]: DynamoDBAttributeValue } = {};
for (const [k, v] of Object.entries(value as Record<string, unknown>)) {
Expand All @@ -82,7 +76,6 @@ function convertToDynamoDBValue(value: unknown): DynamoDBAttributeValue {
return { M: map };
}

// All strings (including numeric strings) should be stored as strings
return { S: String(value) };
}

Expand Down

0 comments on commit 7b894f5

Please sign in to comment.