Skip to content

Commit b1a1bb0

Browse files
Oskie5802claude
andcommitted
feat: add Haiti (ht-HT) support to isIdentityCard and isMobilePhone
Closes #2656 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e36b279 commit b1a1bb0

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

src/lib/isIdentityCard.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,15 @@ const validators = {
227227

228228
return DNI.test(sanitized);
229229
},
230+
'ht-HT': (str) => {
231+
// Haiti National Identity Card (CIN - Carte d'Identité Nationale)
232+
// Format: 1 letter followed by 10 digits (11 characters total)
233+
const CIN = /^[A-Z]\d{10}$/;
234+
235+
const sanitized = str.trim().toUpperCase();
236+
237+
return CIN.test(sanitized);
238+
},
230239
'zh-CN': (str) => {
231240
const provincesAndCities = [
232241
'11', // 北京

src/lib/isMobilePhone.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ const phones = {
111111
'fr-RE': /^(\+?262|0|00262)[67]\d{8}$/,
112112
'fr-WF': /^(\+681)?\d{6}$/,
113113
'he-IL': /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/,
114+
'ht-HT': /^(\+?509)?[2-4]\d{7}$/,
114115
'hu-HU': /^(\+?36|06)(20|30|31|50|70)\d{7}$/,
115116
'id-ID': /^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/,
116117
'ir-IR': /^(\+98|0)?9\d{9}$/,

test/validators.test.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6980,6 +6980,22 @@ describe('Validators', () => {
69806980
'12345678!',
69816981
],
69826982
},
6983+
{
6984+
locale: 'ht-HT',
6985+
valid: [
6986+
'A1234567890',
6987+
'B9876543210',
6988+
'Z0000000000',
6989+
'a1234567890',
6990+
],
6991+
invalid: [
6992+
'12345678901',
6993+
'AB123456789',
6994+
'A123456789',
6995+
'A12345678901',
6996+
'A123456789!',
6997+
],
6998+
},
69836999
{
69847000
locale: 'zh-CN',
69857001
valid: [
@@ -8078,6 +8094,24 @@ describe('Validators', () => {
80788094
'064349089895623459',
80798095
],
80808096
},
8097+
{
8098+
locale: 'ht-HT',
8099+
valid: [
8100+
'+50923456789',
8101+
'+50931234567',
8102+
'+50941234567',
8103+
'23456789',
8104+
'31234567',
8105+
'41234567',
8106+
],
8107+
invalid: [
8108+
'+50951234567',
8109+
'+50901234567',
8110+
'12345678',
8111+
'5091234567',
8112+
'123456',
8113+
],
8114+
},
80818115
{
80828116
locale: 'hu-HU',
80838117
valid: [

0 commit comments

Comments
 (0)