Skip to content

Commit

Permalink
Merge pull request #489 from gabrieljmj/master
Browse files Browse the repository at this point in the history
Added validator for brazilian phone numbers
  • Loading branch information
chriso committed Feb 8, 2016
2 parents dc0efc9 + c2ffa60 commit 03f9b10
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#### 4.7.1

- Added validator for brazilian phone numbers ([#489](https://github.com/chriso/validator.js/pull/489))
- Use [node-depd](https://github.com/dougwilson/nodejs-depd) to print deprecation notices
([#487](https://github.com/chriso/validator.js/issues/487))

Expand Down
19 changes: 19 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,25 @@ describe('Validators', function () {
args: ['de-DE']
});

test({
validator: 'isMobilePhone'
, valid: [
'55-17-3332-2155'
, '55-15-25661234'
, '551223456789'
, '01523456987'
, '022995678947'
, '+55-12-996551215'
]
, invalid: [
'+017-123456789'
, '5501599623874'
, '+55012962308'
, '+55-015-1234-3214'
],
args: ['pt-BR']
});

test({
validator: 'isMobilePhone'
, valid: [
Expand Down
1 change: 1 addition & 0 deletions validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
'en-AU': /^(\+?61|0)4\d{8}$/,
'en-HK': /^(\+?852\-?)?[569]\d{3}\-?\d{4}$/,
'fr-FR': /^(\+?33|0)[67]\d{8}$/,
'pt-BR': /^(\+?55|0)\-?[1-9]{2}\-?[2-9]{1}\d{3,4}\-?\d{4}$/,
'pt-PT': /^(\+?351)?9[1236]\d{7}$/,
'el-GR': /^(\+?30)?(69\d{8})$/,
'en-GB': /^(\+?44|0)7\d{9}$/,
Expand Down

0 comments on commit 03f9b10

Please sign in to comment.