Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

iterate arguments properly

  • Loading branch information...
commit 0b763a89d44ddade084aee30cef6dbafc1f35b70 1 parent 1eb0e51
@aheckmann aheckmann authored
Showing with 10 additions and 5 deletions.
  1. +10 −5 lib/schematype.js
View
15 lib/schematype.js
@@ -160,13 +160,18 @@ SchemaType.prototype.get = function (fn) {
SchemaType.prototype.validate = function (obj, error) {
if ('function' == typeof obj) {
- this.validators.push([obj, error]);
+ this.validators.push([obj, error]);
+ return this;
}
- else {
- for (var i in arguments) {
- this.validators.push([arguments[i].validator, arguments[i].msg]);
- }
+
+ var i = arguments.length
+ , arg
+
+ while (i--) {
+ arg = arguments[i];
+ this.validators.push([arg.validator, arg.msg]);
}
+
return this;
};
Please sign in to comment.
Something went wrong with that request. Please try again.