dynamodb-types
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

DynamoDB Types

Converts JSON Object to DynamoDB Required JSON Object format.

NPM Version Build Status Downloads Stats

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 – @yakovmeisterso@tfwno.gf

Distributed under the MIT license. See LICENSE for more information.

https://github.com/yakovmeister/

Contributing

  1. Fork it (https://github.com/yakovmeister/dynamodb-types/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Package Sidebar

Install

npm i dynamodb-types

Weekly Downloads

9

Version

1.0.4

License

MIT

Unpacked Size

60.1 kB

Total Files

126

Last publish

Collaborators

  • yakovmeister