-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
docs(isURL): add info about require_tld #2537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(isURL): add info about require_tld #2537
Conversation
Thanks for the PR! I'll check what's wrong with the tests, that should not be due to your change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want to add this information in other places as well;
Lines 8 to 21 in 2866bb1
/* | |
options for isURL method | |
require_protocol - if set as true isURL will return false if protocol is not present in the URL | |
require_valid_protocol - isURL will check if the URL's protocol is present in the protocols option | |
protocols - valid protocols can be modified with this option | |
require_host - if set as false isURL will not check if host is present in the URL | |
require_port - if set as true isURL will check if port is present in the URL | |
allow_protocol_relative_urls - if set as true protocol relative URLs will be allowed | |
validate_length - if set as false isURL will skip string length validation | |
max_allowed_length will be ignored if this is set as false | |
max_allowed_length - if set isURL will not allow URLs longer than max_allowed_length | |
default is 2084 that IE maximum URL length | |
*/ |
Line 113 in 2866bb1
**isFQDN(str [, options])** | check if the string is a fully qualified domain name (e.g. domain.com).<br/><br/>`options` is an object which defaults to `{ require_tld: true, allow_underscores: false, allow_trailing_dot: false, allow_numeric_tld: false, allow_wildcard: false, ignore_max_length: false }`. If `allow_wildcard` is set to true, the validator will allow domain starting with `*.` (e.g. `*.example.com` or `*.shop.example.com`). |
Could you add those as well?
Note that isEmail
already has information about require_tld
;
Line 109 in 2866bb1
**isEmail(str [, options])** | check if the string is an email.<br/><br/>`options` is an object which defaults to `{ allow_display_name: false, require_display_name: false, allow_utf8_local_part: true, require_tld: true, allow_ip_domain: false, allow_underscores: false, domain_specific_validation: false, blacklisted_chars: '', host_blacklist: [] }`. If `allow_display_name` is set to true, the validator will also match `Display Name <email-address>`. If `require_display_name` is set to true, the validator will reject strings without the format `Display Name <email-address>`. If `allow_utf8_local_part` is set to false, the validator will not allow any non-English UTF8 character in email address' local part. If `require_tld` is set to false, email addresses without a TLD in their domain will also be matched. If `ignore_max_length` is set to true, the validator will not check for the standard max length of an email. If `allow_ip_domain` is set to true, the validator will allow IP addresses in the host part. If `domain_specific_validation` is true, some additional validation will be enabled, e.g. disallowing certain syntactically valid email addresses that are rejected by Gmail. If `blacklisted_chars` receives a string, then the validator will reject emails that include any of the characters in the string, in the name part. If `host_blacklist` is set to an array of strings or regexp, and the part of the email after the `@` symbol matches one of the strings defined in it, the validation fails. If `host_whitelist` is set to an array of strings or regexp, and the part of the email after the `@` symbol matches none of the strings defined in it, the validation fails. |
@WikiRik updated! |
Let me know when #2538 is in and I'll merge main again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicky comments, but would be great if you could implement this as well
Sure thing! |
@sgress454 we've updated the CI workflow file so I'm not allowed to update your branch. Could you do it yourself? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2537 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 114 114
Lines 2535 2535
Branches 641 641
=========================================
Hits 2535 2535 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@WikiRik ✅ ! |
Adds information about the
require_tld
option to the isURL docs. Although present in the description of theoptions
defaults, it's not listed among the other options so it's easy to miss that this helpful option exists (I did).The options list here is a bit inconsistent as far as the "If set to true..." vs. "If set to false..." language; I opted for "If set to false" since the default is
true
. Happy to clean these all up to make them consistent if there's appetite for that, but I'm starting with a low-touch PR.Checklist