Skip to content

Commit

Permalink
Merge pull request #432 from adebruyne/master
Browse files Browse the repository at this point in the history
Add support for hong kong toll free numbers
  • Loading branch information
floere committed Apr 1, 2019
2 parents cee52fe + 79bf425 commit dc72313
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/phony/countries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,7 @@
# Hong Kong, China

country '852',
match(/^(800)\d+$/) >> split(2, 4) |
none >> split(4,4)

# Macao, China
Expand Down
6 changes: 6 additions & 0 deletions qed/plausibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,12 @@ Mobile.
'+30 909 123 4565'
]

#### Hong Kong
plausible? true: [
'+852800121234', # Toll Free
'+85212341234', # Other Numbers
]

#### Hungary

plausible? true: [
Expand Down
3 changes: 2 additions & 1 deletion spec/lib/phony/countries_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ def self.it_splits number, expected
end

describe 'Hong Kong' do
it_splits '85212341234', ['852', false, '1234', '1234'] #
it_splits '85212341234', ['852', false, '1234', '1234'] #Other Numbers
it_splits '852800121234', ['852', '800', '12', '1234'] #Toll Free
end

describe 'Hungary' do
Expand Down

0 comments on commit dc72313

Please sign in to comment.