1.0.0 • Published 2 years ago

fetch-mrz v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

mrz-parser

travis build codecov coverage version downloads MIT License

Parses the MRZ found of Passport and Travel Documents and returns the data in a human readable form.

Example:

var lib = require('./dist/index.js');
var data = lib.parse('P<CANMARTIN<<SARAH<<<<<<<<<<<<<<<<<<<<<<<<<<ZE000509<9CAN8501019F2301147<<<<<<<<<<<<<<08');

The Result is a javascript object with the decoded information:

{
  documentCode: 'P',
  documentType: 'PASSPORT',
  documentTypeCode: null,
  issuer: 'CAN',
  names: {
    lastName: 'MARTIN',
    names: [
      'SARAH'
    ]
  },
  documentNumber: 'ZE000509',
  nationality: {
    abbr: 'CAN',
    full: 'Canada'
  },
  dob: {
    year: '1985',
    month: '01',
    day: '01',
    original: '850101'
  },
  sex: {
    abbr: 'F',
    full: 'Female'
  },
  checkDigit: {
    documentNumber: {
      value: '9',
      valid: true
    },
    dob: {
      value: '9',
      valid: true
    },
    expiry: {
      value: '7',
      valid: true
    },
    personalNumber: {
      value: '0',
      valid: true
    },
    finalCheck: {
      value: '8',
      valid: true
    },
    valid: true
  },
  expiry: {
    year: '2023',
    month: '01',
    day: '14',
    original: '230114'
  },
  personalNumber: ''
}