We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2190b92 commit 09d38feCopy full SHA for 09d38fe
1 file changed
String/ValidateEmail.js
@@ -1,11 +1,22 @@
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
+ Function that takes a string input and return either true or false
+ If it is a valid email address
7
*/
8
+/*
+* Doctests
+*
9
+* > validateEmail('mahfoudh.arous@gmail.com')
10
+* true
11
+* > validateEmail('mahfoudh.arous@helsinki.edu')
12
13
+* > validateEmail('mahfoudh.arous.com')
14
+* false
15
+* > validateEmail('')
16
+* ! TypeError
17
+* > validateEmail(null)
18
19
+*/
20
const validateEmail = (str) => {
21
if (str === '' || str === null) {
22
throw new TypeError('Email Address String Null or Empty.')
0 commit comments