Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/lib/isIdentityCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,20 @@
}
return true;
},
'ht-HT': (str) => {
// Haiti National Identity Card (CIN - Carte d'Identité Nationale)
// Format: 1 letter followed by 10 digits (11 characters total)
const CIN = /^[A-Za-z]\d{10}$/;

// sanitize user input
const sanitized = str.trim().toUpperCase();

// validate the data structure
if (!CIN.test(sanitized)) {
return false;
}
return true;
},
'zh-CN': (str) => {
const provincesAndCities = [
'11', // 北京
Expand Down Expand Up @@ -452,4 +466,4 @@
return false;
}
throw new Error(`Invalid locale '${locale}'`);
}
}

Check failure on line 469 in src/lib/isIdentityCard.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 18

Newline required at end of file but not found

Check failure on line 469 in src/lib/isIdentityCard.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 16

Newline required at end of file but not found

Check failure on line 469 in src/lib/isIdentityCard.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 20

Newline required at end of file but not found

Check failure on line 469 in src/lib/isIdentityCard.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 12

Newline required at end of file but not found

Check failure on line 469 in src/lib/isIdentityCard.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 22

Newline required at end of file but not found

Check failure on line 469 in src/lib/isIdentityCard.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 14

Newline required at end of file but not found

Check failure on line 469 in src/lib/isIdentityCard.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 8

Newline required at end of file but not found

Check failure on line 469 in src/lib/isIdentityCard.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 10

Newline required at end of file but not found
3 changes: 2 additions & 1 deletion src/lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
'fr-RE': /^(\+?262|0|00262)[67]\d{8}$/,
'fr-WF': /^(\+681)?\d{6}$/,
'he-IL': /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/,
'ht-HT': /^(\+?509)?[2-4]\d{7}$/,
'hu-HU': /^(\+?36|06)(20|30|31|50|70)\d{7}$/,
'id-ID': /^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/,
'ir-IR': /^(\+98|0)?9\d{9}$/,
Expand Down Expand Up @@ -210,4 +211,4 @@
throw new Error(`Invalid locale '${locale}'`);
}

export const locales = Object.keys(phones);
export const locales = Object.keys(phones);

Check failure on line 214 in src/lib/isMobilePhone.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 18

Newline required at end of file but not found

Check failure on line 214 in src/lib/isMobilePhone.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 16

Newline required at end of file but not found

Check failure on line 214 in src/lib/isMobilePhone.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 20

Newline required at end of file but not found

Check failure on line 214 in src/lib/isMobilePhone.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 12

Newline required at end of file but not found

Check failure on line 214 in src/lib/isMobilePhone.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 22

Newline required at end of file but not found

Check failure on line 214 in src/lib/isMobilePhone.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 14

Newline required at end of file but not found

Check failure on line 214 in src/lib/isMobilePhone.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 8

Newline required at end of file but not found

Check failure on line 214 in src/lib/isMobilePhone.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 10

Newline required at end of file but not found
Loading