From 20167d0123461f03b5f80258d1b1559d03a0ebe6 Mon Sep 17 00:00:00 2001 From: Ankit Date: Mon, 28 Dec 2015 22:39:45 +0530 Subject: [PATCH 1/2] Update validator.js Adding mobile verification for Indian numbers. --- validator.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/validator.js b/validator.js index 9a4440b14..a4336af30 100644 --- a/validator.js +++ b/validator.js @@ -98,7 +98,8 @@ 'nb-NO': /^(\+?47)?[49]\d{7}$/, 'nn-NO': /^(\+?47)?[49]\d{7}$/, 'vi-VN': /^(0|\+?84)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/, - 'en-NZ': /^(\+?64|0)2\d{7,9}$/ + 'en-NZ': /^(\+?64|0)2\d{7,9}$/, + 'en-IN': /^(\+?91|0)?[789]\d{9}$/ }; // from http://goo.gl/0ejHHW From c86a2ec2790518d1b621118383ce32d9045bbfbf Mon Sep 17 00:00:00 2001 From: Ankit Date: Tue, 29 Dec 2015 03:52:50 +0530 Subject: [PATCH 2/2] Updated Readme for India Mobile Numbers --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 998b43c8a..a05756357 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ $ bower install validator-js - **isLength(str, min [, max])** - check if the string's length falls in a range. Note: this function takes into account surrogate pairs. - **isLowercase(str)** - check if the string is lowercase. - **isMACAddress(str)** - check if the string is a MAC address. -- **isMobilePhone(str, locale)** - check if the string is a mobile phone number, (locale is one of `['zh-CN', 'zh-TW', 'en-ZA', 'en-AU', 'en-HK', 'pt-PT', 'fr-FR', 'el-GR', 'en-GB', 'en-US', 'en-ZM', 'ru-RU', 'nb-NO', 'nn-NO', 'vi-VN', 'en-NZ']`). +- **isMobilePhone(str, locale)** - check if the string is a mobile phone number, (locale is one of `['zh-CN', 'zh-TW', 'en-ZA', 'en-AU', 'en-HK', 'pt-PT', 'fr-FR', 'el-GR', 'en-GB', 'en-US', 'en-ZM', 'ru-RU', 'nb-NO', 'nn-NO', 'vi-VN', 'en-NZ', 'en-IN']`). - **isMongoId(str)** - check if the string is a valid hex-encoded representation of a [MongoDB ObjectId][mongoid]. - **isMultibyte(str)** - check if the string contains one or more multibyte chars. - **isNull(str)** - check if the string is null.