fetch-mrz

1.0.0 • Public • Published

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: ''
}

Package Sidebar

Install

npm i fetch-mrz

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

48.2 kB

Total Files

10

Last publish

Collaborators

  • mohammadrah1m