mrz-gen
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

Machine-readable zone code generator

This library helps to generate Machine-readable zone codes. It's implemented with Node.js and TypeScript.

Dependencies:

The project depends on the following dev libraries:

  • Node.js;
  • TypeScript;
  • jest and ts-jest;
  • ts-node-dev;
  • tslint.

Installation

To install it as your project dependency, run:

$ npm install mrz-gen

API

The library exports some methods:

  • generate – the function that actually generates the code. It validates the data and generates the MRZ code.;

Basic example

You could use generate function to generate a machine-readable zone code.

import { generate } from 'mrz-gen';
 
const code = generate({
  user: {
    firstName: 'Jane',
    lastName: 'Lodges',
    passportNumber: '123456789',
    countryCode: 'USA',
    nationality: 'USA',
    birthday: '01.02.1983',
    gender: 'F',
    validUntilDay: '02.03.2028',
    personalNumber: '12345678901234',
  },
});
 
// Prints P<USALODGES<<JANE<<<<<<<<<<<<<<<<<<<<<<<<<<<\n1234567897USA8302010F28030211234567890123454
console.log(code);

Copyright

Author: Sachin Lubana (@lubanasachin)

Package Sidebar

Install

npm i mrz-gen

Weekly Downloads

30

Version

1.0.8

License

ISC

Unpacked Size

47.4 kB

Total Files

14

Last publish

Collaborators

  • lubanasachin70