-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathKOR.coffee
53 lines (46 loc) · 1.05 KB
/
KOR.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Phone = require('../Phone')
PhoneNumber = require('../PhoneNumber')
# For more info check:
# http://www.howtocallabroad.com/south-korea/
# https://en.wikipedia.org/wiki/Telephone_numbers_in_Korea
class Korea
constructor: ->
@countryName = "Korea"
@countryNameAbbr = "KOR"
@countryCode = '82'
@regex = /^(?:(?:(?:\+|)82)|)(?:[0]\d{5,9})$/
@optionalTrunkPrefix = '0'
@nationalNumberSeparator = ' '
@nationalDestinationCode =
[
'02',
'051',
'053',
'032',
'062',
'042',
'052',
'044',
'031',
'033',
'043',
'041',
'063',
'061',
'054',
'055',
'064'
]
specialRules: (withoutCountryCode, withoutNDC, ndc) =>
return new PhoneNumber(@countryNameAbbr, @countryCode, ndc, withoutNDC)
splitNumber: (number) =>
if number.length is 7
return Phone.compact number.split(/(\d{3})(\d{4})/)
else if number.length is 8
return Phone.compact number.split(/(\d{4})(\d{4})/)
return [number]
# register
korea = new Korea()
Phone.countries['82'] = korea
# exports
module.exports = korea