Simple Schema validation for DynamoDB style schemas
dynamo-schema is a sanitization and validation module for Amazon DynamoDB data models. It is meant as an item schema and is meant to be used in conjunction with the low level methods provided by dynamo drivers such as this one .
var Schema = require'dynamo-schema';schema =name: 'S'created_at: 'N'colors: 'SS'dates: 'NN';var output = schemasanitizename: 'Andrew'created_at: Datenowcolors: 'red' 'blue'dates: Datenow+1000 Datenow+2000;var new_object = schemaparseoutput;// new object should be identical to the original object passed into sanitize
npm install dynamo-schema
Ensure you have mocha installed.
npm install mocha.
mocha test/test.js --reporter spec