Allow to use register and registerAsync on a new Validator instance to register custom rules that are only scoped to the instance.
My proposal is to add rules property to the options object in the constructor (explained in more detailed #97). Where rules would be an object where the keys are the rule names and the their values would be functions.
~~But that would require changes on how custom validation functions are registered.
As of now you must pass a errorMessage on calling register function, but for the registerAsync the errorMessage is passed to the pass(false, errorMessage).
There is a need normalizing the arguments for both register and registerAsync.~~
Looked at source-code, looks like README.md is not update-to-date.
What are you thoughts about this? I can make a PR if interested.
Feature request:
Allow to use
register
andregisterAsync
on anew Validator
instance to register custom rules that are only scoped to the instance.My proposal is to add
rules
property to theoptions
object in the constructor (explained in more detailed #97). Whererules
would be an object where the keys are the rule names and the their values would be functions.~~But that would require changes on how custom validation functions are registered. As of now you must pass a
errorMessage
on callingregister
function, but for theregisterAsync
theerrorMessage
is passed to thepass(false, errorMessage)
. There is a need normalizing the arguments for bothregister
andregisterAsync
.~~ Looked at source-code, looks likeREADME.md
is not update-to-date.What are you thoughts about this? I can make a PR if interested.