Permalink
Browse files

Change the way the ‘enum’ attribute reports errors

  • Loading branch information...
1 parent e7c05ce commit 3ffe2478ebe66d612fb29395ac9b78daf094ad81 @Baggz committed Mar 12, 2012
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/engines/json/attributes/enum.js
@@ -2,9 +2,13 @@
* Enum
*/
Validation.prototype.addAttributeConstructor('enum', function enumConstructor() {
+ return function(property, propertyValue, attributeValue, propertyAttributes, callback) {
+
+ if (attributeValue.indexOf(propertyValue) === -1) {
+ this.addError();
+ }
+
+ return callback();
- return function enum(property, propertyValue, attributeValue, propertyAttributes, callback) {
- return (attributeValue.indexOf(propertyValue) === -1) ? callback(true) : callback();
};
-
});

0 comments on commit 3ffe247

Please sign in to comment.