1.0.4 • Published 6 years ago
dynamodb-types v1.0.4
DynamoDB Types
Converts JSON Object to DynamoDB Required JSON Object format.
An easy way to convert your JSON data to DynamoDB required format, basically it just converts the value to { data-type-key: value } format, and it supports nested JSON data.
Installation
npm install --save dynamodb-types
Usage example
let DynamoTypes = require('dynamodb-types')
DynamoTypes.parse({
id: 1,
name: 'John Doe',
age: 16
})
// The code above would convert the JSON Object to:
// {
// id: {
// N: 1
// },
// name: {
// S: 'John Doe'
// },
// age: {
// N: 16
// }
// }
// You can also use the DynamoTypes.parseUpdate to generate an AttributeValueUpdate Format
// Example:
DynamoTypes.parseUpdate
.add({ name: 'John Doe' })
.put({ age: 12 })
.delete('postal_id')
.getValue()
// The code above would convert the JSON Object to:
// {
// "name":{
// "Action":"ADD",
// "Value":{
// "S":"John Doe"
// }
// },
// "age":{
// "Action":"PUT",
// "Value":{
// "N":12
// }
// },
// "postal_id":{
// "Action":"DELETE"
// }
// }
Development setup
You can clone the Github repository and run the following npm command.
npm install
Release History
- 1.0.3
- fixed issue with list
- Corrected Backward compatibility errors
- 1.0.0
- Initial Release
Contributor
Jacob Baring – @yakovmeister – so@tfwno.gf
Distributed under the MIT license. See LICENSE
for more information.
https://github.com/yakovmeister/
Contributing
- Fork it (https://github.com/yakovmeister/dynamodb-types/fork)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request