-
-
Save SimonHoiberg/469c2ad3db55b16edbea2c6720d3d83c to your computer and use it in GitHub Desktop.
Unwrap a DynamoDB item
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dynamoItemUnwrap = (dynamoItem) => { | |
if (!dynamoItem) { | |
return null; | |
} | |
return Object.entries(dynamoItem).reduce((transformed, [key, value]) => { | |
const [[, innerValue]] = Object.entries(value); | |
return { | |
...transformed, | |
[key]: innerValue, | |
}; | |
}, {}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment