Skip to content
This repository was archived by the owner on Nov 2, 2023. It is now read-only.

Commit dbdb322

Browse files
author
Enrico Marino
committed
Replaced "maxDecimal" attribute with "divisibleBy" attribute
1 parent 1f3275e commit dbdb322

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/validate.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,8 @@ var validate = exports._validate = function(/*Any*/instance,/*Object*/schema,/*O
179179
addError("does not have a value in the enumeration " + enumer.join(", "));
180180
}
181181
}
182-
if(typeof schema.maxDecimal == 'number' &&
183-
(value.toString().match(new RegExp("\\.[0-9]{" + (schema.maxDecimal + 1) + ",}")))){
184-
addError("may only have " + schema.maxDecimal + " digits of decimal places");
182+
if(typeof schema.divisibleBy == 'number' && (value % schema.divisibleBy !== 0)){
183+
addError("may be divisible by " + schema.divisibleBy);
185184
}
186185
}
187186
}

0 commit comments

Comments
 (0)