UNPKG
obey
Version:
latest (5.0.1)
5.0.1
5.0.0
4.1.2
4.1.1
4.1.0
4.0.2
4.0.1
4.0.0
3.0.5
3.0.4
3.0.3
3.0.2
3.0.1
3.0.0
2.0.2
2.0.1
2.0.0
1.8.2
1.7.4
1.7.3
1.7.1
1.7.0
1.6.1
1.6.0
1.5.0
1.4.6
1.4.5
1.4.4
1.4.3
1.4.2
1.4.1
1.4.0
1.3.1
1.3.0
1.2.0
1.1.0
1.0.0
0.12.1
0.12.0
0.11.5
0.11.3
0.11.2
0.11.1
0.11.0
0.10.1
0.10.0
0.9.1
0.9.0
0.8.0
0.7.0
0.6.0
0.5.1
0.5.0
0.0.1
0.0.0
Data modelling and validation library
github.com/psvet/obey
psvet/obey
obey
/
src
/
typeStrategies
/
email.js
13 lines
(11 loc)
•
277 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
const
email
=
{ _regex: {
default
: /.+@.+\.\S+/ },
default
: context => {
if
(context.value ==
null
|| !context.value || !context.value.toString().match(email._regex.
default
)) { context.fail(
'Value must be a valid email'
) } } }
module
.
exports
= email