mikeerickson / validatorjs

A data validation library in JavaScript for the browser and Node.js, inspired by Laravel's Validator.
https://www.npmjs.com/package/validatorjs
MIT License
1.77k stars 280 forks source link

How does sometimes rule work? #244

Open erezmus opened 6 years ago

erezmus commented 6 years ago

There doesn't seem to be any documentation about how to use the sometimes rule. I've also tried to look at the code but can't really work it out. In laravel you are supposed to give a callback but not sure if that's how its implemented here

tried with validatorjs v3.14.2

vict-shevchenko commented 6 years ago

'something' rule return true for any value, meaning field under validation will be always valid. Also, it is not documented in official docs, so I may suppose that this is reserved for future.