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

Update validate group argument to options object #63

Open ricardogama opened 7 years ago

ricardogama commented 7 years ago

This PR updates the last group argument of Validator.validate method to be an options object. To validate with assertion groups, the group option can be provided on the options argument:

Validator.validate({ foo: 'bar' }, {
  foo: [is('bar').equalTo('bar'), is('biz').equalTo('biz')]
}, {
  group: 'bar'
});

This is a breaking change but will enable adding more optional features in a scalable manner, as the ones proposed on #60 and #61.