Socket
Socket
Sign inDemoInstall

mrz

Package Overview
Dependencies
Maintainers
4
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mrz - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

lib-esm/parse/frenchDrivingLicence.d.ts

1

lib-esm/formats.d.ts

@@ -8,3 +8,4 @@ export type FormatType = keyof typeof formats;

readonly FRENCH_NATIONAL_ID: "FRENCH_NATIONAL_ID";
readonly FRENCH_DRIVING_LICENSE: "FRENCH_DRIVING_LICENSE";
};
//# sourceMappingURL=formats.d.ts.map

@@ -8,3 +8,4 @@ 'use strict';

FRENCH_NATIONAL_ID: 'FRENCH_NATIONAL_ID',
FRENCH_DRIVING_LICENSE: 'FRENCH_DRIVING_LICENSE',
};
//# sourceMappingURL=formats.js.map

@@ -27,2 +27,7 @@ import parseCompositeCheckDigit from '../parsers/parseCompositeCheckDigit';

};
declare const documentCodeAlphaNumTemplate: {
label: string;
field: "documentCode";
type: "ALPHANUMERIC";
};
declare const nationalityTemplate: {

@@ -94,3 +99,3 @@ label: string;

};
export { documentNumberTemplate, documentNumberCheckDigitTemplate, documentCodeTemplate, nationalityTemplate, sexTemplate, expirationDateTemplate, expirationDateCheckDigitTemplate, birthDateTemplate, birthDateCheckDigitTemplate, issueDateTemplate, compositeCheckDigitTemplate, firstNameTemplate, lastNameTemplate, issuingStateTemplate, };
export { documentNumberTemplate, documentNumberCheckDigitTemplate, documentCodeTemplate, documentCodeAlphaNumTemplate, nationalityTemplate, sexTemplate, expirationDateTemplate, expirationDateCheckDigitTemplate, birthDateTemplate, birthDateCheckDigitTemplate, issueDateTemplate, compositeCheckDigitTemplate, firstNameTemplate, lastNameTemplate, issuingStateTemplate, };
//# sourceMappingURL=fieldTemplates.d.ts.map

@@ -29,2 +29,7 @@ 'use strict';

};
const documentCodeAlphaNumTemplate = {
label: 'Document code',
field: 'documentCode',
type: fieldTypes.ALPHANUMERIC,
};
const nationalityTemplate = {

@@ -96,3 +101,3 @@ label: 'Nationality',

};
export { documentNumberTemplate, documentNumberCheckDigitTemplate, documentCodeTemplate, nationalityTemplate, sexTemplate, expirationDateTemplate, expirationDateCheckDigitTemplate, birthDateTemplate, birthDateCheckDigitTemplate, issueDateTemplate, compositeCheckDigitTemplate, firstNameTemplate, lastNameTemplate, issuingStateTemplate, };
export { documentNumberTemplate, documentNumberCheckDigitTemplate, documentCodeTemplate, documentCodeAlphaNumTemplate, nationalityTemplate, sexTemplate, expirationDateTemplate, expirationDateCheckDigitTemplate, birthDateTemplate, birthDateCheckDigitTemplate, issueDateTemplate, compositeCheckDigitTemplate, firstNameTemplate, lastNameTemplate, issuingStateTemplate, };
//# sourceMappingURL=fieldTemplates.js.map

@@ -7,2 +7,10 @@ 'use strict';

switch (lines.length) {
case 1: {
switch (lines[0].length) {
case 30:
return parsers.frenchDrivingLicense(lines, options);
default:
throw new Error(`unrecognized document format. First line of input must have 30 (French Driving License) characters and it has a length of ${lines[0].length}`);
}
}
case 2:

@@ -31,3 +39,3 @@ case 3: {

default:
throw new Error(`unrecognized document format. Input must have two or three lines, found ${lines.length}`);
throw new Error(`unrecognized document format. Input must have one, two or three lines, found ${lines.length}`);
}

@@ -34,0 +42,0 @@ }

@@ -0,1 +1,2 @@

import parseFrenchDrivingLicense from './frenchDrivingLicence';
import parseFrenchNationalId from './frenchNationalId';

@@ -12,3 +13,4 @@ import parseSwissDrivingLicense from './swissDrivingLicense';

frenchNationalId: typeof parseFrenchNationalId;
frenchDrivingLicense: typeof parseFrenchDrivingLicense;
};
//# sourceMappingURL=parsers.d.ts.map
'use strict';
import parseFrenchDrivingLicense from './frenchDrivingLicence';
import parseFrenchNationalId from './frenchNationalId';

@@ -13,3 +14,4 @@ import parseSwissDrivingLicense from './swissDrivingLicense';

frenchNationalId: parseFrenchNationalId,
frenchDrivingLicense: parseFrenchDrivingLicense,
};
//# sourceMappingURL=parsers.js.map

2

lib-esm/types.d.ts

@@ -32,3 +32,3 @@ export interface Autocorrect {

export type FieldName = 'administrativeCode' | 'administrativeCode2' | 'birthDate' | 'birthDateCheckDigit' | 'compositeCheckDigit' | 'documentNumber' | 'documentNumberCheckDigit' | 'documentCode' | 'expirationDate' | 'expirationDateCheckDigit' | 'firstName' | 'issueDate' | 'issuingState' | 'languageCode' | 'lastName' | 'nationality' | 'optional' | 'optional1' | 'optional2' | 'personalNumber' | 'personalNumberCheckDigit' | 'pinCode' | 'sex' | 'versionNumber';
export type MRZFormat = 'TD1' | 'TD3' | 'TD2' | 'FRENCH_NATIONAL_ID' | 'SWISS_DRIVING_LICENSE';
export type MRZFormat = 'TD1' | 'TD3' | 'TD2' | 'FRENCH_NATIONAL_ID' | 'FRENCH_DRIVING_LICENSE' | 'SWISS_DRIVING_LICENSE';
//# sourceMappingURL=types.d.ts.map

@@ -8,3 +8,4 @@ export type FormatType = keyof typeof formats;

readonly FRENCH_NATIONAL_ID: "FRENCH_NATIONAL_ID";
readonly FRENCH_DRIVING_LICENSE: "FRENCH_DRIVING_LICENSE";
};
//# sourceMappingURL=formats.d.ts.map

@@ -10,3 +10,4 @@ 'use strict';

FRENCH_NATIONAL_ID: 'FRENCH_NATIONAL_ID',
FRENCH_DRIVING_LICENSE: 'FRENCH_DRIVING_LICENSE',
};
//# sourceMappingURL=formats.js.map

@@ -27,2 +27,7 @@ import parseCompositeCheckDigit from '../parsers/parseCompositeCheckDigit';

};
declare const documentCodeAlphaNumTemplate: {
label: string;
field: "documentCode";
type: "ALPHANUMERIC";
};
declare const nationalityTemplate: {

@@ -94,3 +99,3 @@ label: string;

};
export { documentNumberTemplate, documentNumberCheckDigitTemplate, documentCodeTemplate, nationalityTemplate, sexTemplate, expirationDateTemplate, expirationDateCheckDigitTemplate, birthDateTemplate, birthDateCheckDigitTemplate, issueDateTemplate, compositeCheckDigitTemplate, firstNameTemplate, lastNameTemplate, issuingStateTemplate, };
export { documentNumberTemplate, documentNumberCheckDigitTemplate, documentCodeTemplate, documentCodeAlphaNumTemplate, nationalityTemplate, sexTemplate, expirationDateTemplate, expirationDateCheckDigitTemplate, birthDateTemplate, birthDateCheckDigitTemplate, issueDateTemplate, compositeCheckDigitTemplate, firstNameTemplate, lastNameTemplate, issuingStateTemplate, };
//# sourceMappingURL=fieldTemplates.d.ts.map

@@ -6,3 +6,3 @@ 'use strict';

Object.defineProperty(exports, "__esModule", { value: true });
exports.issuingStateTemplate = exports.lastNameTemplate = exports.firstNameTemplate = exports.compositeCheckDigitTemplate = exports.issueDateTemplate = exports.birthDateCheckDigitTemplate = exports.birthDateTemplate = exports.expirationDateCheckDigitTemplate = exports.expirationDateTemplate = exports.sexTemplate = exports.nationalityTemplate = exports.documentCodeTemplate = exports.documentNumberCheckDigitTemplate = exports.documentNumberTemplate = void 0;
exports.issuingStateTemplate = exports.lastNameTemplate = exports.firstNameTemplate = exports.compositeCheckDigitTemplate = exports.issueDateTemplate = exports.birthDateCheckDigitTemplate = exports.birthDateTemplate = exports.expirationDateCheckDigitTemplate = exports.expirationDateTemplate = exports.sexTemplate = exports.nationalityTemplate = exports.documentCodeAlphaNumTemplate = exports.documentCodeTemplate = exports.documentNumberCheckDigitTemplate = exports.documentNumberTemplate = void 0;
const parseCompositeCheckDigit_1 = __importDefault(require("../parsers/parseCompositeCheckDigit"));

@@ -38,2 +38,8 @@ const parseDate_1 = __importDefault(require("../parsers/parseDate"));

exports.documentCodeTemplate = documentCodeTemplate;
const documentCodeAlphaNumTemplate = {
label: 'Document code',
field: 'documentCode',
type: createFieldParser_1.fieldTypes.ALPHANUMERIC,
};
exports.documentCodeAlphaNumTemplate = documentCodeAlphaNumTemplate;
const nationalityTemplate = {

@@ -40,0 +46,0 @@ label: 'Nationality',

@@ -8,2 +8,10 @@ 'use strict';

switch (lines.length) {
case 1: {
switch (lines[0].length) {
case 30:
return parsers_1.parsers.frenchDrivingLicense(lines, options);
default:
throw new Error(`unrecognized document format. First line of input must have 30 (French Driving License) characters and it has a length of ${lines[0].length}`);
}
}
case 2:

@@ -32,3 +40,3 @@ case 3: {

default:
throw new Error(`unrecognized document format. Input must have two or three lines, found ${lines.length}`);
throw new Error(`unrecognized document format. Input must have one, two or three lines, found ${lines.length}`);
}

@@ -35,0 +43,0 @@ }

@@ -0,1 +1,2 @@

import parseFrenchDrivingLicense from './frenchDrivingLicence';
import parseFrenchNationalId from './frenchNationalId';

@@ -12,3 +13,4 @@ import parseSwissDrivingLicense from './swissDrivingLicense';

frenchNationalId: typeof parseFrenchNationalId;
frenchDrivingLicense: typeof parseFrenchDrivingLicense;
};
//# sourceMappingURL=parsers.d.ts.map

@@ -7,2 +7,3 @@ 'use strict';

exports.parsers = void 0;
const frenchDrivingLicence_1 = __importDefault(require("./frenchDrivingLicence"));
const frenchNationalId_1 = __importDefault(require("./frenchNationalId"));

@@ -19,3 +20,4 @@ const swissDrivingLicense_1 = __importDefault(require("./swissDrivingLicense"));

frenchNationalId: frenchNationalId_1.default,
frenchDrivingLicense: frenchDrivingLicence_1.default,
};
//# sourceMappingURL=parsers.js.map

@@ -32,3 +32,3 @@ export interface Autocorrect {

export type FieldName = 'administrativeCode' | 'administrativeCode2' | 'birthDate' | 'birthDateCheckDigit' | 'compositeCheckDigit' | 'documentNumber' | 'documentNumberCheckDigit' | 'documentCode' | 'expirationDate' | 'expirationDateCheckDigit' | 'firstName' | 'issueDate' | 'issuingState' | 'languageCode' | 'lastName' | 'nationality' | 'optional' | 'optional1' | 'optional2' | 'personalNumber' | 'personalNumberCheckDigit' | 'pinCode' | 'sex' | 'versionNumber';
export type MRZFormat = 'TD1' | 'TD3' | 'TD2' | 'FRENCH_NATIONAL_ID' | 'SWISS_DRIVING_LICENSE';
export type MRZFormat = 'TD1' | 'TD3' | 'TD2' | 'FRENCH_NATIONAL_ID' | 'FRENCH_DRIVING_LICENSE' | 'SWISS_DRIVING_LICENSE';
//# sourceMappingURL=types.d.ts.map
{
"name": "mrz",
"version": "4.0.0",
"version": "4.1.0",
"description": "Parse MRZ (Machine Readable Zone) from identity documents",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -11,2 +11,3 @@ 'use strict';

FRENCH_NATIONAL_ID: 'FRENCH_NATIONAL_ID',
FRENCH_DRIVING_LICENSE: 'FRENCH_DRIVING_LICENSE',
} as const;

@@ -6,3 +6,3 @@ 'use strict';

describe('Bad MRZ', () => {
it('More then 3 lines', () => {
it('More than 3 lines', () => {
const MRZ = [

@@ -15,3 +15,3 @@ 'IDFRATEST<NAME<<<<<<<<<<<<<<<<0CHE02',

expect(() => parse(MRZ)).toThrow(
'unrecognized document format. Input must have two or three lines, found 4',
'unrecognized document format. Input must have one, two or three lines, found 4',
);

@@ -18,0 +18,0 @@ });

@@ -37,2 +37,8 @@ 'use strict';

const documentCodeAlphaNumTemplate = {
label: 'Document code',
field: 'documentCode',
type: fieldTypes.ALPHANUMERIC,
} satisfies FieldOptionTemplate;
const nationalityTemplate = {

@@ -119,2 +125,3 @@ label: 'Nationality',

documentCodeTemplate,
documentCodeAlphaNumTemplate,
nationalityTemplate,

@@ -121,0 +128,0 @@ sexTemplate,

@@ -15,2 +15,12 @@ 'use strict';

switch (lines.length) {
case 1: {
switch (lines[0].length) {
case 30:
return parsers.frenchDrivingLicense(lines, options);
default:
throw new Error(
`unrecognized document format. First line of input must have 30 (French Driving License) characters and it has a length of ${lines[0].length}`,
);
}
}
case 2:

@@ -41,3 +51,3 @@ case 3: {

throw new Error(
`unrecognized document format. Input must have two or three lines, found ${lines.length}`,
`unrecognized document format. Input must have one, two or three lines, found ${lines.length}`,
);

@@ -44,0 +54,0 @@ }

'use strict';
import parseFrenchDrivingLicense from './frenchDrivingLicence';
import parseFrenchNationalId from './frenchNationalId';

@@ -15,2 +16,3 @@ import parseSwissDrivingLicense from './swissDrivingLicense';

frenchNationalId: parseFrenchNationalId,
frenchDrivingLicense: parseFrenchDrivingLicense,
};

@@ -69,2 +69,3 @@ 'use strict';

| 'FRENCH_NATIONAL_ID'
| 'FRENCH_DRIVING_LICENSE'
| 'SWISS_DRIVING_LICENSE';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc