Permalink
Browse files

Minor improvements of the ‘divisibleBy’ attribute

  • Loading branch information...
Baggz committed Mar 8, 2012
1 parent fb1b2d4 commit 7a1b3b90a83c5e6655d5e78cb3b53d37ffd45e75
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/engines/json/attributes.js
@@ -243,10 +243,12 @@ Validation.prototype.attributes = {
*/
divisibleBy: function divisibleByConstructor() {
return function divisibleBy(property, propertyValue, attributeValue, propertyAttributes, callback) {
- var isNumber = typeof propertyValue === 'number',
- isDivisible = propertyValue % attributeValue === 0;
- return (isNumber && isDivisible) ? callback() : callback(true);
- }
+ if (isNumber(propertyValue) && (propertyValue % attributeValue === 0)) {
+ return callback();
+ } else {
+ return callback(true);
+ }
+ };
}
};

0 comments on commit 7a1b3b9

Please sign in to comment.