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

email-validation

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

email-validation - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

lib/email-validation.js~

0

index.js
module.exports = require('./lib/email-validation');

3

lib/email-validation.js

@@ -15,3 +15,3 @@ var util = require('util');

var escapers = strToObj('\\"');
var hostchars = strToObj("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.");
var hostchars = strToObj("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-");

@@ -54,2 +54,3 @@ email.parse = function(address, dothrow, callback) {

if(typeof hostchars[address[i]] == 'undefined') throw util.format("[Error parsing email address: character '%s' (pos: %s) is not allowed in the hostname section]", address[i], i);
if(i >= hoststartpos && /[@\.]/.test(address[i - 1]) && !/[a-z0-9]/i.test(address[i])) throw util.format("[Error parsing email address: All domain segments must start with a letter or number, never a symbol like '%s'.")
_domain += address[i];

@@ -56,0 +57,0 @@ }

{
"name": "email-validation",
"version": "0.1.0",
"version": "0.1.1",
"description": "Email validation that follows the specs.",

@@ -5,0 +5,0 @@ "keywords": [],

@@ -0,0 +0,0 @@ email-validation

@@ -6,4 +6,2 @@ var email = require('../index');

var parsegood = email.parse("niceandsimple@example.com");
console.log("niceandsimple@example.com");
console.log(parsegood);
assert.equal(parsegood['user'], 'niceandsimple');

@@ -13,4 +11,2 @@ assert.equal(parsegood['domain'], 'example.com');

parsegood = email.parse('"@somethingsomething"@example.com');
console.log('"@somethingsomething"@example.com');
console.log(parsegood);
assert.equal(parsegood['user'], '"@somethingsomething"');

@@ -32,3 +28,3 @@ assert.equal(parsegood['domain'], 'example.com');

assert.equal(email.valid('"email@example.com'), false);
assert.equal(email.valid('"email@example.com'), false);
assert.ok(email.valid('one.two@one-two.com'));

@@ -40,2 +36,3 @@ //bad

assert.equal(email.valid('bad@ThisAddressIsGreaterThanTwoHundredAndFiftyThreeCharactersLetsSeeHowManyICanFitInHereWithoutDestroyingTheWorld.com.Unfortunatly.we.were.not.quite.there.yet.but.we.getting.closer.by.the.minute.I.assure.you.we.are.almost.there.dot.some.new.top.level.domain.com.us.tz.kosher'), false);
assert.equal(email.valid('one.two@-one-two.com'), false);

@@ -42,0 +39,0 @@ //shamelessly copied from http://en.wikipedia.org/wiki/Email_address

@@ -0,0 +0,0 @@ var email = require('../index');

@@ -0,0 +0,0 @@ console.time("25 emails time ten thousand tries");

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