Im using Joi library as standalone validator for my CRA project but when firing email()
validator im getting cryptic error
Uncaught Error: Built-in TLD list disabled
minDomainSegments - the minimum number of domain segments (e.g. x.y.z has 3 segments) required in the domain part. Defaults to 2 . tlds - options to validate the top-level-domain segment (e.g. com in example.com ) where: deny - a Set with strings matching forbidden TLD values (all non-matching values are allowed).
From Joi documentation:
By default, the TLD must be a valid name listed on the IANA registry. To disable validation, set tlds to false. To customize how TLDs are validated, set one of these:
allow - one of:
To disable TLD validation against IANA accepted list:
email: Joi.string().email({ tlds: { allow: false } });
This should disable the validation and allow you to accept any TLD even if it's not IANA registered.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With