Comparing version 0.2.3 to 0.2.4
# CHANGELOG | ||
## 0.2.4 | ||
* Update Email Regexp | ||
## 0.2.3 | ||
@@ -4,0 +8,0 @@ |
@@ -20,3 +20,3 @@ "use strict"; | ||
exports.isEmail = curry(function (message, value) { | ||
var valid = /^[a-z0-9_\-\.]{2,}@[a-z0-9_\-\.]{2,}\.[a-z]{2,}$/i.test(value); | ||
var valid = /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i.test(value); | ||
return valid ? null : message(value); | ||
@@ -23,0 +23,0 @@ }); |
{ | ||
"name": "policeman", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "Lightweight yet powerful schema validator", | ||
@@ -5,0 +5,0 @@ "main": "lib/policeman.js", |
@@ -26,3 +26,3 @@ import * as curry from "lodash/curry"; | ||
export const isEmail = curry((message: Message, value: string) => { | ||
const valid = /^[a-z0-9_\-\.]{2,}@[a-z0-9_\-\.]{2,}\.[a-z]{2,}$/i.test(value); | ||
const valid = /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i.test(value); | ||
return valid ? null : message(value); | ||
@@ -29,0 +29,0 @@ }); |
@@ -45,2 +45,3 @@ import * as tape from "tape"; | ||
t.is(email("foo@bar.com"), null, "isEmail accepts valid email"); | ||
t.is(email("foo+1@bar.com"), null, "isEmail accepts valid email"); | ||
t.is(email("foo@.com"), "is invalid email", "isEmail fails on invalid email"); | ||
@@ -64,3 +65,3 @@ } | ||
tape("validators", (t: tape.Test) => { | ||
t.plan(21); | ||
t.plan(22); | ||
testIsRequired(t); | ||
@@ -67,0 +68,0 @@ testIsMinLengthValidator(t); |
@@ -33,2 +33,3 @@ "use strict"; | ||
t.is(email("foo@bar.com"), null, "isEmail accepts valid email"); | ||
t.is(email("foo+1@bar.com"), null, "isEmail accepts valid email"); | ||
t.is(email("foo@.com"), "is invalid email", "isEmail fails on invalid email"); | ||
@@ -49,3 +50,3 @@ } | ||
tape("validators", function (t) { | ||
t.plan(21); | ||
t.plan(22); | ||
testIsRequired(t); | ||
@@ -52,0 +53,0 @@ testIsMinLengthValidator(t); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
715310
21521