Skip to content

Commit 1da96c4

Browse files
Add Cambodia (km-KH) support to isMobilePhone
1 parent 6f436be commit 1da96c4

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

src/lib/isMobilePhone.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ const phones = {
162162
'ar-EH': /^(\+?212|0)[\s\-]?(5288|5289)[\s\-]?\d{5}$/,
163163
'fa-AF': /^(\+93|0)?(2{1}[0-8]{1}|[3-5]{1}[0-4]{1})(\d{7})$/,
164164
'mk-MK': /^(\+?389|0)?((?:2[2-9]\d{6}|(?:3[1-4]|4[2-8])\d{6}|500\d{5}|5[2-9]\d{6}|7[0-9][2-9]\d{5}|8[1-9]\d{6}|800\d{5}|8009\d{4}))$/,
165+
// Cambodia
166+
'km-KH': /^(\+?855)([1-9]\d{7,8})$/,
165167
};
166168
/* eslint-enable max-len */
167169

test/validators.test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6558,6 +6558,28 @@ describe('Validators', () => {
65586558

65596559
it('should validate identity cards', () => {
65606560
const fixtures = [
6561+
{
6562+
locale: 'km-KH',
6563+
valid: [
6564+
'+85512345678',
6565+
'+855123456789',
6566+
'+85598765432',
6567+
'+85519876543',
6568+
'85512345678',
6569+
'855123456789',
6570+
'85598765432',
6571+
'85519876543',
6572+
],
6573+
invalid: [
6574+
'+85502345678', // starts with 0 after country code
6575+
'+8551234567', // too short
6576+
'+8551234567890', // too long
6577+
'12345678', // missing country code
6578+
'+855abcdefgh', // letters
6579+
'',
6580+
'+855',
6581+
],
6582+
},
65616583
{
65626584
locale: 'PK',
65636585
valid: [

0 commit comments

Comments
 (0)