Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve null attributes being wrapped when parsed #521

Merged
merged 3 commits into from
Apr 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
.
  • Loading branch information
naorpeled committed Apr 21, 2023
commit 9459453964651d862040ce012924d1dfbc5d9634
6 changes: 3 additions & 3 deletions src/lib/formatItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Linked } from './parseEntity'

// Convert from DocumentClient values, which may be wrapped sets or numbers,
// into normal TS values.
const convertDynamoValues = (value: unknown, attr?: PureAttributeDefinition) => {
const convertDynamoValues = (value: unknown, attr?: PureAttributeDefinition): unknown => {
if (value === null) {
return value
}
Expand All @@ -28,10 +28,10 @@ const convertDynamoValues = (value: unknown, attr?: PureAttributeDefinition) =>

// Convert wrapped number values to bigints
if (attr && attr.type === 'bigint') {
value = BigInt(value as number | string)
value = BigInt(value as number)
}
if (attr && attr.type === 'number') {
value = Number(value)
value = Number(value as number)
}

return value
Expand Down