Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dynamoose

Package Overview
Dependencies
Maintainers
1
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynamoose - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

36

lib/Attribute.js

@@ -22,2 +22,4 @@ 'use strict';

this.required = options.required;
this.set = options.set;
this.get = options.get;

@@ -213,2 +215,6 @@ this.applyValidation(options.validate);

if(this.set) {
val = this.set(val);
}
var type = this.type;

@@ -290,20 +296,36 @@ var isSet = this.isSet && !noSet;

var val;
switch(this.type.name) {
case 'string':
return dedynamofy('S', this.isSet, json);
val = dedynamofy('S', this.isSet, json);
break;
case 'number':
return dedynamofy('N', this.isSet, json, JSON.parse);
val = dedynamofy('N', this.isSet, json, JSON.parse);
break;
case 'boolean':
return dedynamofy('S', this.isSet, json, JSON.parse);
val = dedynamofy('S', this.isSet, json, JSON.parse);
break;
case 'date':
return dedynamofy('N', this.isSet, json, datify);
val = dedynamofy('N', this.isSet, json, datify);
break;
case 'object':
return dedynamofy('S', this.isSet, json, JSON.parse);
val = dedynamofy('S', this.isSet, json, JSON.parse);
break;
case 'array':
return dedynamofy('S', this.isSet, json, JSON.parse);
val = dedynamofy('S', this.isSet, json, JSON.parse);
break;
case 'buffer':
return dedynamofy('B', this.isSet, json, bufferify);
val = dedynamofy('B', this.isSet, json, bufferify);
break;
default:
throw new errors.SchemaError('Invalid attribute type: ' + this.type);
}
if(this.get) {
val = this.get(val);
}
return val;
};

@@ -310,0 +332,0 @@

{
"name": "dynamoose",
"version": "0.1.0",
"version": "0.1.1",
"description": "Dynamoose is a modeling tool for Amazon's DynamoDB (inspired by Mongoose)",
"homepage": "https://github.com/automategreen/dynamoose",
"repository": {
"type": "git",
"url": "https://github.com/automategreen/dynamoose"
},
"bugs": {
"email": "support@automategreen.com",
"url": "https://github.com/automategreen/dynamoose/issues"
},
"main": "index.js",

@@ -6,0 +15,0 @@ "scripts": {

@@ -213,2 +213,10 @@ # Dynamoose [![Build Status](https://travis-ci.org/automategreen/dynamoose.png)](https://travis-ci.org/automategreen/dynamoose)

**set**: function
Adds a setter function that will be used to transform the value before writing to the DB.
**get**: function
Adds a getter function that will be used to transform the value return from the DB.
**trim**: boolean

@@ -215,0 +223,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc