Is it better to not require validator method starting with `is`?
Closed this issue · 1 comments
mocheng commented
In my team, this has already happened twice. Developer name extended validator as checkChinesePhoneNumber
and it doesn't work.
It costs half an hour to figure out that all validator methods must start with is
, as below code states.
https://github.com/samora/validr/blob/master/lib/validr.js#L27-L30
// Verify valid validator method.
var notValidator = (method.slice(0, 2) !== 'is'
&& method !== 'equals'
&& method !== 'contains'
&& method !== 'matches');
To save more time for validr users, would it better to drop this limitation?
samora commented
I agree, it will be better to drop that limitation.
Although the readme highlights this point in the extending Valir section.
This limitation is there mainly because of the names of validator's methods which validr uses internally.