Passed
Push — main ( 815f74...226e09 )
by Rushan
02:04 queued 12s
created

is.HTML5Email   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
package is
2
3
import "github.com/muonsoft/validation/validate"
4
5
// Email is used for simplified validation of an email address. It allows all values
6
// with an "@" symbol in, and a "." in the second host part of the email address.
7
func Email(value string) bool {
8
	return looseEmailRegex.MatchString(value)
9
}
10
11
// HTML5Email is used for validation of an email address based on pattern for HTML5
12
// (see https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address).
13
func HTML5Email(value string) bool {
14
	return html5EmailRegex.MatchString(value)
15
}
16
17
// URL is used to check that value is a valid URL string. By default (if no schemas are passed),
18
// the function checks only for the http:// and https:// schemas. Use the schemas argument
19
// to configure the list of expected schemas. If an empty string is passed as a schema, then
20
// URL value may be treated as relative (without schema, e.g. "//example.com").
21
func URL(value string, schemas ...string) bool {
22
	return validate.URL(value, schemas...) == nil
23
}
24