Build README
This commit is contained in:
12
README.md
12
README.md
@ -73,6 +73,7 @@
|
||||
* [Unique values of array](#unique-values-of-array)
|
||||
* [URL parameters](#url-parameters)
|
||||
* [UUID generator](#uuid-generator)
|
||||
* [Validate email](#validate-email)
|
||||
* [Validate number](#validate-number)
|
||||
* [Value or default](#value-or-default)
|
||||
|
||||
@ -768,6 +769,17 @@ const uuid = _ =>
|
||||
// uuid() -> '7982fcfe-5721-4632-bede-6000885be57d'
|
||||
```
|
||||
|
||||
### Validate email
|
||||
|
||||
Use a regular experssion to check if the email is valid.
|
||||
Returns `true` if email is valid, `false` if not.
|
||||
|
||||
```js
|
||||
const validateEmail = str =>
|
||||
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(str);
|
||||
// validateEmail(mymail@gmail.com) -> true
|
||||
```
|
||||
|
||||
### Validate number
|
||||
|
||||
Use `!isNaN` in combination with `parseFloat()` to check if the argument is a number.
|
||||
|
||||
@ -3,9 +3,8 @@
|
||||
Use a regular experssion to check if the email is valid.
|
||||
Returns `true` if email is valid, `false` if not.
|
||||
|
||||
```js
|
||||
```js
|
||||
const validateEmail = str =>
|
||||
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(str);
|
||||
// isemail(mymail@gmail.com) -> true
|
||||
```
|
||||
|
||||
// validateEmail(mymail@gmail.com) -> true
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user