Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some fixes to isIdentityCard('he-IL') #1048

Merged
merged 11 commits into from Jun 20, 2019
8 changes: 1 addition & 7 deletions lib/isIdentityCard.js
Expand Up @@ -33,7 +33,7 @@ var validators = {
return sanitized.endsWith(controlDigits[number % 23]);
},
'he-IL': function heIL(str) {
var DNI = /^\d+$/; // sanitize user input
var DNI = /^\d{9}$/; // sanitize user input

var sanitized = str.trim(); // validate the data structure

Expand All @@ -42,12 +42,6 @@ var validators = {
}

var id = sanitized;

if (id.length !== 9 || isNaN(id)) {
// Make sure ID is formatted properly
return false;
}

var sum = 0,
incNum;

Expand Down
6 changes: 1 addition & 5 deletions src/lib/isIdentityCard.js
Expand Up @@ -31,7 +31,7 @@ const validators = {
return sanitized.endsWith(controlDigits[number % 23]);
},
'he-IL': (str) => {
const DNI = /^\d+$/;
const DNI = /^\d{9}$/;

// sanitize user input
const sanitized = str.trim();
Expand All @@ -43,10 +43,6 @@ const validators = {

const id = sanitized;

if (id.length !== 9 || isNaN(id)) {
// Make sure ID is formatted properly
return false;
}
let sum = 0,
incNum;
for (let i = 0; i < id.length; i++) {
Expand Down
8 changes: 1 addition & 7 deletions validator.js
Expand Up @@ -1137,7 +1137,7 @@ var validators = {
return sanitized.endsWith(controlDigits[number % 23]);
},
'he-IL': function heIL(str) {
var DNI = /^\d+$/; // sanitize user input
var DNI = /^\d{9}$/; // sanitize user input

var sanitized = str.trim(); // validate the data structure

Expand All @@ -1146,12 +1146,6 @@ var validators = {
}

var id = sanitized;

if (id.length !== 9 || isNaN(id)) {
// Make sure ID is formatted properly
return false;
}

var sum = 0,
incNum;

Expand Down
2 changes: 1 addition & 1 deletion validator.min.js

Large diffs are not rendered by default.