Permalink
Browse files

Move the ‘divisibleBy’ attribute into a separate file

  • Loading branch information...
1 parent a900248 commit e3577c243e99e4adb2f7b9c06794cf555844f7c2 @Baggz committed Mar 9, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 src/engines/json/attributes/divisibleBy.js
View
14 src/engines/json/attributes/divisibleBy.js
@@ -0,0 +1,14 @@
+/**
+ * DivisibleBy
+ */
+Validation.prototype.addAttributeConstructor('divisibleBy', function divisibleByConstructor() {
+
+ return function divisibleBy(property, propertyValue, attributeValue, propertyAttributes, callback) {
+ if (isNumber(propertyValue) && (propertyValue % attributeValue === 0)) {
+ return callback();
+ } else {
+ return callback(true);
+ }
+ };
+
+});

0 comments on commit e3577c2

Please sign in to comment.