Skip to content

Instantly share code, notes, and snippets.

@SimonHoiberg
Created November 14, 2020 14:59
Show Gist options
  • Save SimonHoiberg/469c2ad3db55b16edbea2c6720d3d83c to your computer and use it in GitHub Desktop.
Save SimonHoiberg/469c2ad3db55b16edbea2c6720d3d83c to your computer and use it in GitHub Desktop.
Unwrap a DynamoDB item
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