Socket
Socket
Sign inDemoInstall

mrz

Package Overview
Dependencies
0
Maintainers
4
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.3 to 3.1.4

17

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

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

"eslint-fix": "npm run eslint -- --fix",
"test": "npm run test-coverage && npm run eslint && npm run prettier",
"test-coverage": "jest --coverage",
"test-only": "jest",
"test": "npm run test-only && npm run eslint && npm run prettier",
"test-only": "jest --coverage",
"build": "npm run buildStates && cheminfo-build",

@@ -42,8 +41,8 @@ "prettier": "prettier --check .",

"devDependencies": {
"cheminfo-build": "^1.1.10",
"eslint": "^7.26.0",
"eslint-config-cheminfo": "^5.2.4",
"jest": "^26.6.3",
"prettier": "^2.3.0"
"cheminfo-build": "^1.1.11",
"eslint": "^8.13.0",
"eslint-config-cheminfo": "^7.3.0",
"jest": "^27.5.1",
"prettier": "^2.6.2"
}
}

@@ -13,5 +13,6 @@ 'use strict';

}
expect(codes).toHaveLength(270);
expect(codes).toHaveLength(276);
expect(states.CHE).toBe('Switzerland');
expect(states.DEU).toBe('Germany');
});
});
'use strict';
const states = {
"AFG": "Afghanistan",
"ALA": "Åland Islands",
"ALB": "Albania",

@@ -19,3 +18,3 @@ "DZA": "Algeria",

"AZE": "Azerbaijan",
"BHS": "Bahamas",
"BHS": "Bahamas (the)",
"BHR": "Bahrain",

@@ -30,3 +29,3 @@ "BGD": "Bangladesh",

"BTN": "Bhutan",
"BOL": "Bolivia, Plurinational State of",
"BOL": "Bolivia (Plurinational State of)",
"BES": "Bonaire, Sint Eustatius and Saba",

@@ -37,3 +36,3 @@ "BIH": "Bosnia and Herzegovina",

"BRA": "Brazil",
"IOT": "British Indian Ocean Territory",
"IOT": "British Indian Ocean Territory (the)",
"BRN": "Brunei Darussalam",

@@ -47,4 +46,4 @@ "BGR": "Bulgaria",

"CAN": "Canada",
"CYM": "Cayman Islands",
"CAF": "Central African Republic",
"CYM": "Cayman Islands (the)",
"CAF": "Central African Republic (the)",
"TCD": "Chad",

@@ -54,10 +53,9 @@ "CHL": "Chile",

"CXR": "Christmas Island",
"CCK": "Cocos (Keeling) Islands",
"CCK": "Cocos (Keeling) Islands (the)",
"COL": "Colombia",
"COM": "Comoros",
"COG": "Congo",
"COD": "Congo, Democratic Republic of the",
"COK": "Cook Islands",
"COM": "Comoros (the)",
"COD": "Congo (the Democratic Republic of the)",
"COG": "Congo (the)",
"COK": "Cook Islands (the)",
"CRI": "Costa Rica",
"CIV": "Côte d’Ivoire",
"HRV": "Croatia",

@@ -67,7 +65,8 @@ "CUB": "Cuba",

"CYP": "Cyprus",
"CZE": "Czech Republic",
"CZE": "Czechia",
"CIV": "Côte d'Ivoire",
"DNK": "Denmark",
"DJI": "Djibouti",
"DMA": "Dominica",
"DOM": "Dominican Republic",
"DOM": "Dominican Republic (the)",
"ECU": "Ecuador",

@@ -79,5 +78,6 @@ "EGY": "Egypt",

"EST": "Estonia",
"SWZ": "Eswatini",
"ETH": "Ethiopia",
"FLK": "Falkland Islands (Malvinas)",
"FRO": "Faroe Islands",
"FLK": "Falkland Islands (the) [Malvinas]",
"FRO": "Faroe Islands (the)",
"FJI": "Fiji",

@@ -88,7 +88,7 @@ "FIN": "Finland",

"PYF": "French Polynesia",
"ATF": "French Southern Territories",
"ATF": "French Southern Territories (the)",
"GAB": "Gabon",
"GMB": "Gambia",
"GMB": "Gambia (the)",
"GEO": "Georgia",
"D": "Germany",
"DEU": "Germany",
"GHA": "Ghana",

@@ -108,5 +108,5 @@ "GIB": "Gibraltar",

"HMD": "Heard Island and McDonald Islands",
"VAT": "Holy See (Vatican City State)",
"VAT": "Holy See (the)",
"HND": "Honduras",
"HKG": "Hong Kong Special Administrative Region of China",
"HKG": "Hong Kong",
"HUN": "Hungary",

@@ -129,7 +129,7 @@ "ISL": "Iceland",

"KIR": "Kiribati",
"PRK": "Korea, Democratic People’s Republic of",
"KOR": "Korea, Republic of",
"PRK": "Korea (the Democratic People's Republic of)",
"KOR": "Korea (the Republic of)",
"KWT": "Kuwait",
"KGZ": "Kyrgyzstan",
"LAO": "Lao People’s Democratic Republic",
"LAO": "Lao People's Democratic Republic (the)",
"LVA": "Latvia",

@@ -143,4 +143,3 @@ "LBN": "Lebanon",

"LUX": "Luxembourg",
"MAC": "Macao Special Administrative Region of China",
"MKD": "Macedonia, the former Yugoslav Republic of",
"MAC": "Macao",
"MDG": "Madagascar",

@@ -152,3 +151,3 @@ "MWI": "Malawi",

"MLT": "Malta",
"MHL": "Marshall Islands",
"MHL": "Marshall Islands (the)",
"MTQ": "Martinique",

@@ -160,3 +159,3 @@ "MRT": "Mauritania",

"FSM": "Micronesia (Federated States of)",
"MDA": "Moldova, Republic of",
"MDA": "Moldova (the Republic of)",
"MCO": "Monaco",

@@ -172,13 +171,12 @@ "MNG": "Mongolia",

"NPL": "Nepal",
"NLD": "Netherlands",
"ANT": "Netherlands Antilles",
"NTZ": "Neutral Zone",
"NLD": "Netherlands (the)",
"NCL": "New Caledonia",
"NZL": "New Zealand",
"NIC": "Nicaragua",
"NER": "Niger",
"NER": "Niger (the)",
"NGA": "Nigeria",
"NIU": "Niue",
"NFK": "Norfolk Island",
"MNP": "Northern Mariana Islands",
"MKD": "North Macedonia",
"MNP": "Northern Mariana Islands (the)",
"NOR": "Norway",

@@ -193,3 +191,3 @@ "OMN": "Oman",

"PER": "Peru",
"PHL": "Philippines",
"PHL": "Philippines (the)",
"PCN": "Pitcairn",

@@ -200,6 +198,6 @@ "POL": "Poland",

"QAT": "Qatar",
"REU": "Réunion",
"ROU": "Romania",
"RUS": "Russian Federation",
"RUS": "Russian Federation (the)",
"RWA": "Rwanda",
"REU": "Réunion",
"BLM": "Saint Barthélemy",

@@ -231,12 +229,11 @@ "SHN": "Saint Helena, Ascension and Tristan da Cunha",

"LKA": "Sri Lanka",
"SDN": "Sudan",
"SDN": "Sudan (the)",
"SUR": "Suriname",
"SJM": "Svalbard and Jan Mayen",
"SWZ": "Swaziland",
"SWE": "Sweden",
"CHE": "Switzerland",
"SYR": "Syrian Arab Republic",
"TWN": "Taiwan Province of China",
"SYR": "Syrian Arab Republic (the)",
"TWN": "Taiwan (Province of China)",
"TJK": "Tajikistan",
"TZA": "Tanzania, United Republic of",
"TZA": "Tanzania, the United Republic of",
"THA": "Thailand",

@@ -251,18 +248,14 @@ "TLS": "Timor-Leste",

"TKM": "Turkmenistan",
"TCA": "Turks and Caicos Islands",
"TCA": "Turks and Caicos Islands (the)",
"TUV": "Tuvalu",
"UGA": "Uganda",
"UKR": "Ukraine",
"ARE": "United Arab Emirates",
"GBR": "United Kingdom - British Citizen",
"GBD": "United Kingdom - British Overseas Territories Citizen",
"GBN": "United Kingdom - British National (Overseas)",
"GBO": "United Kingdom - British Overseas Citizen",
"GBP": "United Kingdom - British Protected person",
"USA": "United States",
"UMI": "United States Minor Outlying Islands",
"ARE": "United Arab Emirates (the)",
"GBR": "United Kingdom of Great Britain and Northern Ireland (the)",
"UMI": "United States Minor Outlying Islands (the)",
"USA": "United States of America (the)",
"URY": "Uruguay",
"UZB": "Uzbekistan",
"VUT": "Vanuatu",
"VEN": "Venezuela, Bolivarian Republic of",
"VEN": "Venezuela (Bolivarian Republic of)",
"VNM": "Viet Nam",

@@ -272,6 +265,14 @@ "VGB": "Virgin Islands (British)",

"WLF": "Wallis and Futuna",
"ESH": "Western Sahara",
"ESH": "Western Sahara*",
"YEM": "Yemen",
"ZMB": "Zambia",
"ZWE": "Zimbabwe",
"ALA": "Åland Islands",
"GBD": "British Overseas Territories Citizen",
"GBN": "British National (Overseas)",
"GBO": "British Overseas Citizen",
"GBS": "British Subject",
"GBP": "British Protected Person",
"RKS": "Republic of Kosovo",
"D": "Germany",
"EUE": "European Union (EU)",

@@ -284,12 +285,17 @@ "UNO": "United Nations Organization or one of its officials",

"XCC": "Caribbean Community or one of its emissaries (CARICOM)",
"XCE": "Council of Europe",
"XCO": "Common Market for Eastern and Southern Africa (COMESA)",
"XEC": "Economic Community of West African States (ECOWAS)",
"XPO": "International Criminal Police Organization (INTERPOL)",
"XES": "Organization of Eastern Caribbean States (OECS)",
"XOM": "Sovereign Military Order of Malta or one of its emissaries",
"XDC": "Southern African Development Community",
"XXA": "Stateless person, as defined in Article 1 of the 1954 Convention Relating to the Status of Stateless Persons",
"XXB": "Refugee, as defined in Article 1 of the 1951 Convention Relating to the Status of Refugees as amended by the 1967 Protocol",
"XXC": "Refugee, other than as defined under the code XXB above",
"XXX": "Person of unspecified nationality, for whom issuing State does not consider it necessary to specify any of the codes XXA, XXB or XXC above, whatever that person’s status may be. This category may include a person who is neither stateless nor a refugee but who is of unknown nationality and legally residing in the State of issue."
"XXX": "Person of unspecified nationality, for whom issuing State does not consider it necessary to specify any of the codes XXA, XXB or XXC above, whatever that person’s status may be. This category may include a person who is neither stateless nor a refugee but who is of unknown nationality and legally residing in the State of issue.",
"ANT": "Netherlands Antilles",
"NTZ": "Neutral Zone"
};
Object.freeze(states);
module.exports = states;

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

describe('parse French National Id', () => {
it('valid MRZ', function () {
it('valid MRZ', () => {
const MRZ = [

@@ -9,0 +9,0 @@ 'IDFRATEST<NAME<<<<<<<<<<<<<<<<0CHE02',

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

describe('parse Swiss Driving License', () => {
it('valid MRZ', function () {
it('valid MRZ', () => {
const MRZ = [

@@ -15,3 +15,3 @@ 'AAA001D<<',

expect(result.format).toBe('SWISS_DRIVING_LICENSE');
expect(result.valid).toStrictEqual(true);
expect(result.valid).toBe(true);
expect(result.details.filter((a) => !a.valid)).toHaveLength(0);

@@ -18,0 +18,0 @@ expect(result.details[0]).toStrictEqual({

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

});
expect(result.valid).toStrictEqual(false);
expect(
result.details.find((a) => a.field === 'issuingState').valid,
).toStrictEqual(false);
expect(result.valid).toBe(false);
expect(result.details.find((a) => a.field === 'issuingState').valid).toBe(
false,
);

@@ -122,4 +122,4 @@ const optional1 = result.details.find((a) => a.field === 'optional1');

});
expect(result.fields.documentNumber).toStrictEqual('D23145890124');
expect(result.fields.documentNumberCheckDigit).toStrictEqual('0');
expect(result.fields.documentNumber).toBe('D23145890124');
expect(result.fields.documentNumberCheckDigit).toBe('0');

@@ -126,0 +126,0 @@ const documentNumberCheckDigitDetails = result.details.find(

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

describe('parse TD2', () => {
it('Utopia example', function () {
it('Utopia example', () => {
const MRZ = [

@@ -36,4 +36,4 @@ 'I<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<',

});
expect(result.valid).toStrictEqual(false);
expect(result.valid).toBe(false);
});
});

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

describe('parse TD3', () => {
it('Utopia example', function () {
it('Utopia example', () => {
const MRZ = [

@@ -9,0 +9,0 @@ 'P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<',

'use strict';
module.exports = function (fieldOptions) {
module.exports = function createFieldParser(fieldOptions) {
checkType(fieldOptions, 'label', 'string');

@@ -5,0 +5,0 @@ if (fieldOptions.field !== null) {

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc