Comparing version 0.7.0 to 0.7.1
@@ -368,9 +368,2 @@ var crypto = require('crypto'), | ||
function valueEquals(val1, val2) { | ||
if (!val1 || !val2) return false | ||
var key1 = Object.keys(val1)[0], key2 = Object.keys(val2)[0] | ||
if (key1 != key2) return false | ||
return valsEqual(val1[key1], val2[key2]) | ||
} | ||
function valsEqual(val1, val2) { | ||
@@ -387,16 +380,10 @@ if (Array.isArray(val1) && Array.isArray(val2)) { | ||
var results = Object.keys(filter).map(function(attr) { | ||
var comp = filter[attr].ComparisonOperator, | ||
compVals = filter[attr].AttributeValueList, | ||
var comp = filter[attr].Exists != null ? (filter[attr].Exists ? 'NOT_NULL' : 'NULL') : | ||
filter[attr].ComparisonOperator || 'EQ', | ||
compVals = filter[attr].AttributeValueList || (filter[attr].Value ? [filter[attr].Value] : null), | ||
compType = compVals ? Object.keys(compVals[0])[0] : null, | ||
compVal = compVals ? compVals[0][compType] : null, | ||
attrType = val[attr] ? Object.keys(val[attr])[0] : null, | ||
attrVal = val[attr] ? val[attr][attrType] : null, | ||
legacy = !('ComparisonOperator' in filter[attr]) | ||
attrVal = val[attr] ? val[attr][attrType] : null | ||
if (legacy) { | ||
if (filter[attr].Exists === false && attrVal != null) return false | ||
if (filter[attr].Value && !valueEquals(filter[attr].Value, val[attr])) return false | ||
return true | ||
} | ||
switch (comp) { | ||
@@ -403,0 +390,0 @@ case 'EQ': |
{ | ||
"name": "dynalite", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"description": "A mock implementation of Amazon's DynamoDB built on LevelDB", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -393,2 +393,6 @@ var Big = require('big.js') | ||
if ('AttributeValueList' in condition && 'Value' in condition) | ||
return 'One or more parameter values were invalid: ' + | ||
'Value and AttributeValueList cannot be used together for Attribute: ' + key | ||
if ('ComparisonOperator' in condition) { | ||
@@ -398,6 +402,8 @@ if ('Exists' in condition) | ||
'Exists and ComparisonOperator cannot be used together for Attribute: ' + key | ||
if ('AttributeValueList' in condition && | ||
'Value' in condition) | ||
if (condition.ComparisonOperator != 'NULL' && condition.ComparisonOperator != 'NOT_NULL' && | ||
!('AttributeValueList' in condition) && !('Value' in condition)) | ||
return 'One or more parameter values were invalid: ' + | ||
'Value and AttributeValueList cannot be used together for Attribute: ' + key | ||
'Value or AttributeValueList must be used with ComparisonOperator: ' + condition.ComparisonOperator + | ||
' for Attribute: ' + key | ||
@@ -431,3 +437,4 @@ var values = condition.AttributeValueList ? | ||
} | ||
if (!validAttrCount) return 'One or more parameter values were invalid: ' + | ||
if (!validAttrCount) | ||
return 'One or more parameter values were invalid: ' + | ||
'Invalid number of argument(s) for the ' + condition.ComparisonOperator + ' ComparisonOperator' | ||
@@ -434,0 +441,0 @@ } else if ('AttributeValueList' in condition) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
133868
3329