Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

policeman

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

policeman - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

4

CHANGELOG.md
# CHANGELOG
## 0.2.4
* Update Email Regexp
## 0.2.3

@@ -4,0 +8,0 @@

2

lib/validators.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc