forked from catamphetamine/libphonenumber-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.es6.js
245 lines (207 loc) · 7.51 KB
/
index.es6.js
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
// Deprecated.
// Use `libphonenumber-js/min` or `libphonenumber-js/max` or `libphonenumber-js/core` instead.
import metadata from './metadata.min.json'
import parsePhoneNumberCustom from './es6/parsePhoneNumber'
import parsePhoneNumberFromStringCustom from './es6/parsePhoneNumberFromString'
import parseNumberCustom from './es6/parse'
import formatNumberCustom from './es6/format'
import getNumberTypeCustom from './es6/getNumberType'
import getExampleNumberCustom from './es6/getExampleNumber'
import isPossibleNumberCustom from './es6/isPossibleNumber'
import isValidNumberCustom from './es6/validate'
import isValidNumberForRegionCustom from './es6/isValidNumberForRegion'
// Deprecated
import findPhoneNumbersCustom, { searchPhoneNumbers as searchPhoneNumbersCustom } from './es6/findPhoneNumbers'
import { PhoneNumberSearch as PhoneNumberSearchCustom } from './es6/findPhoneNumbers_'
import findNumbersCustom from './es6/findNumbers'
import searchNumbersCustom from './es6/searchNumbers'
import PhoneNumberMatcherCustom from './es6/PhoneNumberMatcher'
import AsYouTypeCustom from './es6/AsYouType'
import getCountryCallingCodeCustom from './es6/getCountryCallingCode'
export { default as Metadata } from './es6/metadata'
import { getExtPrefix as getExtPrefixCustom, isSupportedCountry as isSupportedCountryCustom } from './es6/metadata'
import { parseRFC3966 as parseRFC3966Custom, formatRFC3966 as formatRFC3966Custom } from './es6/RFC3966'
import formatIncompletePhoneNumberCustom from './es6/formatIncompletePhoneNumber'
export { default as parseIncompletePhoneNumber, parsePhoneNumberCharacter } from './es6/parseIncompletePhoneNumber'
// Deprecated: remove DIGITS export in 2.0.0.
// (it was used in `react-phone-number-input`)
export { DIGITS, default as parseDigits } from './es6/parseDigits'
export { default as ParseError } from './es6/ParseError'
export function parsePhoneNumber()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return parsePhoneNumberCustom.apply(this, parameters)
}
export function parsePhoneNumberFromString()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return parsePhoneNumberFromStringCustom.apply(this, parameters)
}
export function parseNumber()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return parseNumberCustom.apply(this, parameters)
}
// Deprecated: remove `parse()` export in 2.0.0.
// (renamed to `parseNumber()`)
export function parse()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return parseNumberCustom.apply(this, parameters)
}
export function formatNumber()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return formatNumberCustom.apply(this, parameters)
}
// Deprecated: remove `format()` export in 2.0.0.
// (renamed to `formatNumber()`)
export function format()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return formatNumberCustom.apply(this, parameters)
}
export function getNumberType()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return getNumberTypeCustom.apply(this, parameters)
}
export function getExampleNumber()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return getExampleNumberCustom.apply(this, parameters)
}
export function isPossibleNumber()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return isPossibleNumberCustom.apply(this, parameters)
}
export function isValidNumber()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return isValidNumberCustom.apply(this, parameters)
}
export function isValidNumberForRegion()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return isValidNumberForRegionCustom.apply(this, parameters)
}
// Deprecated.
export function findPhoneNumbers()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return findPhoneNumbersCustom.apply(this, parameters)
}
// Deprecated.
export function searchPhoneNumbers()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return searchPhoneNumbersCustom.apply(this, parameters)
}
// Deprecated.
export function PhoneNumberSearch(text, options)
{
PhoneNumberSearchCustom.call(this, text, options, metadata)
}
// Deprecated.
PhoneNumberSearch.prototype = Object.create(PhoneNumberSearchCustom.prototype, {})
PhoneNumberSearch.prototype.constructor = PhoneNumberSearch
export function findNumbers()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return findNumbersCustom.apply(this, parameters)
}
export function searchNumbers()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return searchNumbersCustom.apply(this, parameters)
}
export function PhoneNumberMatcher(text, options)
{
PhoneNumberMatcherCustom.call(this, text, options, metadata)
}
PhoneNumberMatcher.prototype = Object.create(PhoneNumberMatcherCustom.prototype, {})
PhoneNumberMatcher.prototype.constructor = PhoneNumberMatcher
export function AsYouType(country)
{
AsYouTypeCustom.call(this, country, metadata)
}
AsYouType.prototype = Object.create(AsYouTypeCustom.prototype, {})
AsYouType.prototype.constructor = AsYouType
export function isSupportedCountry()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return isSupportedCountryCustom.apply(this, parameters)
}
export function getExtPrefix()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return getExtPrefixCustom.apply(this, parameters)
}
export function parseRFC3966()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return parseRFC3966Custom.apply(this, parameters)
}
export function formatRFC3966()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return formatRFC3966Custom.apply(this, parameters)
}
export function formatIncompletePhoneNumber()
{
var parameters = Array.prototype.slice.call(arguments)
parameters.push(metadata)
return formatIncompletePhoneNumberCustom.apply(this, parameters)
}
// Deprecated: remove this in 2.0.0 and make `custom.js` in ES6
// (the old `custom.js` becomes `custom.commonjs.js`).
export { default as parseCustom } from './es6/parse'
export { default as formatCustom } from './es6/format'
export { default as isValidNumberCustom } from './es6/validate'
export { default as findPhoneNumbersCustom } from './es6/findPhoneNumbers'
export { searchPhoneNumbers as searchPhoneNumbersCustom } from './es6/findPhoneNumbers'
export { PhoneNumberSearch as PhoneNumberSearchCustom } from './es6/findPhoneNumbers_'
export { default as getNumberTypeCustom } from './es6/getNumberType'
export { default as getCountryCallingCodeCustom } from './es6/getCountryCallingCode'
export
{
default as AsYouTypeCustom,
// Deprecated: `DIGIT_PLACEHOLDER` was used by `react-phone-number-input`.
// Seems to be not used anymore.
DIGIT_PLACEHOLDER
}
from './es6/AsYouType'
export function getCountryCallingCode(country)
{
return getCountryCallingCodeCustom(country, metadata)
}
// `getPhoneCode` name is deprecated, use `getCountryCallingCode` instead.
export function getPhoneCode(country)
{
return getCountryCallingCode(country)
}
// `getPhoneCodeCustom` name is deprecated, use `getCountryCallingCodeCustom` instead.
export function getPhoneCodeCustom(country, metadata)
{
return getCountryCallingCodeCustom(country, metadata)
}