File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- function that takes a string input and return either it is true of false
3
- a valid email address
4
- e.g.: mahfoudh.arous@gmail.com -> true
5
- e.g.: mahfoudh.arous@helsinki.edu -> true
6
- e.g.: mahfoudh.arous.com ->false
2
+ Function that takes a string input and return either true or false
3
+ If it is a valid email address
7
4
*/
8
5
6
+ /*
7
+ * Doctests
8
+ *
9
+ * > validateEmail('mahfoudh.arous@gmail.com')
10
+ * true
11
+ * > validateEmail('mahfoudh.arous@helsinki.edu')
12
+ * true
13
+ * > validateEmail('mahfoudh.arous.com')
14
+ * false
15
+ * > validateEmail('')
16
+ * ! TypeError
17
+ * > validateEmail(null)
18
+ * ! TypeError
19
+ */
9
20
const validateEmail = ( str ) => {
10
21
if ( str === '' || str === null ) {
11
22
throw new TypeError ( 'Email Address String Null or Empty.' )
You can’t perform that action at this time.
0 commit comments