Comparing version 0.0.6 to 0.0.7
19
index.js
@@ -8,2 +8,3 @@ | ||
var track = data.match(/(.*?\?)(.*?\?)(.*?\?)/); | ||
console.log(track); | ||
var res1 = track[1].match(/(\%)([A-Z]{2})([^\^]{0,13})\^?([^\^]{0,35})\^?([^\^]{0,29})\^?\s*?\?/); | ||
@@ -29,2 +30,20 @@ var res2 = track[2].match(/(;)(\d{6})(\d{0,13})(\=)(\d{4})(\d{8})(\d{0,5})\=?\?/); | ||
"birthday": res2[6], | ||
"birthday": function() { | ||
//19879908 | ||
var dob = res2[6].match(/(\d{4})(\d{2})(\d{2})/); | ||
dob[1] = parseInt(dob[1]); | ||
dob[2] = parseInt(dob[2]); | ||
dob[3] = parseInt(dob[3]); | ||
if (dob[2] === 99) { | ||
/* FL decided to reverse 2012 aamva spec, 99 means here | ||
that dob month === to expiration month, it should be | ||
opposite | ||
*/ | ||
var exp_dt = res2[5].match(/(\d{2})(\d{2})/); | ||
dob[2] = parseInt(exp_dt[2]); | ||
} | ||
dob[2]--; | ||
return (new Date(dob[1], dob[2], dob[3])); | ||
}, | ||
"dl_overflow": res2[7], | ||
@@ -31,0 +50,0 @@ "cds_version": res3[1], |
{ | ||
"name": "aamva", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Parse AAMVA magnetic stripe", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -23,7 +23,8 @@ # aamva.js | ||
var res = aamva.stripe(stripe_data); | ||
console.log("DMV ID:",res.id()); | ||
console.log("First name:",res.name().first); | ||
console.log("Last name:",res.name().last); | ||
console.log("Middle name:",res.name().middle); | ||
console.log("DMV ID:",res.id()); /* D621720820090 */ | ||
console.log("First name:",res.name().first); /* JOHN */ | ||
console.log("Last name:",res.name().last); /* DOE */ | ||
console.log("Middle name:",res.name().middle); /* "" */ | ||
console.log("Sex:",res.sex()); /* MALE, FEMALE, MISSING/INVALID */ | ||
console.log("DOB:",res.birthday()); /* Thu Jan 08 1987 00:00:00 GMT-0500 (EST) */ | ||
console.log("Entire object", res); | ||
@@ -40,3 +41,3 @@ | ||
expiration_date: '2101', | ||
birthday: '19829909', | ||
birthday: [Function], | ||
dl_overflow: '0', | ||
@@ -76,2 +77,3 @@ cds_version: '#', | ||
* 0.0.5 removed logging that was left by mistake | ||
* 0.0.7 inflated birthday to a Date object, and fixed FL AAMVA spec, where expiration month is set to birthday month | ||
@@ -78,0 +80,0 @@ |
@@ -6,3 +6,3 @@ var should = require('chai').should(), | ||
var data = '%FLDELRAY BEACH^DOE$JOHN$^4818 S FEDERAL BLVD^ \?\ | ||
;6360100462172082009=2101198299090=?\ | ||
;6360100462172082009=2101198799080=?\ | ||
#! 33435 I 1600 ECCECC00000?'; | ||
@@ -12,2 +12,3 @@ | ||
describe('state', function() { | ||
@@ -54,1 +55,9 @@ it('should be set to FL', function(){ | ||
}); | ||
describe('DOB', function() { | ||
it('should be set to 19870108', function(){ | ||
var date = new Date(1987,0,8); | ||
console.log(stripe.birthday()); | ||
expect(stripe.birthday().toDateString()).to.equal(date.toDateString()); | ||
}); | ||
}); |
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
8105
124
93