email-validation
Advanced tools
Comparing version 0.1.0 to 0.1.1
module.exports = require('./lib/email-validation'); |
@@ -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
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
14376
10
131