guillaumepotier / validator.js

Powerful objects and strings validation in javascript for Node and the browser
http://validatorjs.org
MIT License
255 stars 39 forks source link

Fix Collection handling of array of assertions #49

Closed nunofgs closed 8 years ago

nunofgs commented 8 years ago

Fixes an issue when validating a Collection with an array of assertions:

I.e.:

validate({
  foo: ['foobar']
}, {
  foo: new Assert().Collection([new Assert().IsString(), new Assert().Length(3)])
})

would crash with:

Error: You must give an Assert or an Asserts array to validate a string
guillaumepotier commented 8 years ago

Great thx!

nunofgs commented 8 years ago

Thank you! Any chance you could publish a release?

guillaumepotier commented 8 years ago

Indeed. Done. Thanks