Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mrz

Package Overview
Dependencies
Maintainers
3
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 3.0.4 to 3.0.5

src/parsers/parseDocumentNumberOptional.js

2

package.json
{
"name": "mrz",
"version": "3.0.4",
"version": "3.0.5",
"description": "Parse MRZ (Machine Readable Zone) from identity documents",

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

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

});
const optional1Details = result.details.find(
(f) => f.field === 'optional1'
);
expect(optional1Details).toMatchObject({
value: '',
line: 0,
start: 15,
end: 15
});
});

@@ -88,4 +98,4 @@

const MRZ = [
'I<UTOD23145890<1240<<<<<<<<<<<',
'7408122F1204159UTO<<<<<<<<<<<0',
'I<UTOD23145890<1240<XYZ<<<<<<<',
'7408122F1204159UTO<<<<<<<<<<<8',
'ERIKSSON<<ANNA<MARIA<<<<<<<<<<'

@@ -107,3 +117,3 @@ ];

{ line: 0, start: 14, end: 15, raw: '<' },
{ line: 0, start: 15, end: 30, raw: '1240<<<<<<<<<<<' }
{ line: 0, start: 15, end: 30, raw: '1240<XYZ<<<<<<<' }
],

@@ -110,0 +120,0 @@ line: 0,

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

const parseOptional = require('../parsers/parseOptional');
const parseDocumentNumberOptional = require('../parsers/parseDocumentNumberOptional');
const {

@@ -75,3 +76,15 @@ documentCodeTemplate,

end: 30,
parser: parseOptional
related: [
{
line: 0,
start: 5,
end: 14
},
{
line: 0,
start: 14,
end: 15
}
],
parser: parseDocumentNumberOptional
},

@@ -78,0 +91,0 @@ Object.assign({}, birthDateTemplate, {

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

if (checkDigit === '<' && optional) {
optional = cleanText(optional);
value = source + optional.substring(0, optional.length - 1);
const firstFiller = optional.indexOf('<');
const tail = optional.substring(0, firstFiller - 1);
value = source + tail;
end = value.length + 1;

@@ -12,0 +13,0 @@ } else {

'use strict';
var check = require('./check');
const cleanText = require('./cleanText');

@@ -12,10 +11,11 @@ module.exports = function parseDocumentNumberCheckDigit(

if (checkDigit === '<' && optional) {
optional = cleanText(optional);
source = `${source}<${optional.substring(0, optional.length - 1)}`;
checkDigit = optional.charAt(optional.length - 1);
const firstFiller = optional.indexOf('<');
const tail = optional.substring(0, firstFiller - 1);
source = `${source}<${tail}`;
checkDigit = optional.charAt(firstFiller - 1);
check(source, checkDigit);
return {
value: checkDigit,
start: optional.length,
end: optional.length + 1
start: firstFiller,
end: firstFiller + 1
};

@@ -22,0 +22,0 @@ } else {

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