-
-
Notifications
You must be signed in to change notification settings - Fork 280
Open
Description
What version of this package are you using?
"validatorjs": "^3.22.1",
What operating system, Node.js, and npm version?
MacOs 12.4
Node v18.13.0
Yarn 1.22.19
I'm using Vite for the build.
What happened?
I have following code:
import * as Validator from 'validatorjs'
Validator.register('amount', value => value.match(/^-?[0-9.,]*$/), 'The :attribute must be a number.');This gives me error on the Validator.register line above:
Uncaught (in promise) TypeError: Cannot set properties of undefined (setting 'amount')
at Object._setRuleMessage (lang.js:36:34)
at Validator.register (validator.js:604:8)
at policy-validation.js:40:11
_
In the source code it errors on line:
this.messages[lang][attribute] = message;
So probably means this.messages[lang] was never set.
What did you expect to happen?
No errors.
Are you willing to submit a pull request to fix this bug?
Maybe if it's simple.
Metadata
Metadata
Assignees
Labels
No labels