-
Notifications
You must be signed in to change notification settings - Fork 214
/
index.cjs.js
130 lines (104 loc) · 4.87 KB
/
index.cjs.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
'use strict'
// This file is deprecated.
// It's the same as `index.cjs`, just with an added `.js` file extension.
// It only exists for compatibility with the software that doesn't like `*.cjs` file extension.
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/62
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/61#note_950728292
var min = require('./min/index.cjs')
var metadata = require('./metadata.min.json')
function withMetadataArgument(func, _arguments) {
var args = Array.prototype.slice.call(_arguments)
args.push(metadata)
return func.apply(this, args)
}
// ES5 `require()` "default" "interoperability" hack.
// https://github.com/babel/babel/issues/2212#issuecomment-131827986
// An alternative approach:
// https://www.npmjs.com/package/babel-plugin-add-module-exports
exports = module.exports = min.parsePhoneNumberFromString
exports['default'] = min.parsePhoneNumberFromString
// `parsePhoneNumberFromString()` named export is now considered legacy:
// it has been promoted to a default export due to being too verbose.
exports.parsePhoneNumberFromString = min.parsePhoneNumberFromString
exports.ParseError = min.ParseError
// `parsePhoneNumber()` named export has been renamed to `parsePhoneNumberWithError()`.
exports.parsePhoneNumber = min.parsePhoneNumberWithError
exports.parsePhoneNumberWithError = min.parsePhoneNumberWithError
exports.isValidPhoneNumber = min.isValidPhoneNumber
exports.isPossiblePhoneNumber = min.isPossiblePhoneNumber
exports.validatePhoneNumberLength = min.validatePhoneNumberLength
// `parse()` and `parseNumber()` functions are deprecated.
var parse_ = require('./build/legacy/parse.js').default
exports.parse = function parse() {
return withMetadataArgument(parse_, arguments)
}
exports.parseNumber = exports.parse
// `format()` and `formatNumber()` functions are deprecated.
var format_ = require('./build/legacy/format.js').default
exports.format = function format() {
return withMetadataArgument(format_, arguments)
}
exports.formatNumber = exports.format
// Deprecated.
var getNumberType_ = require('./build/legacy/getNumberType.js').default
exports.getNumberType = function getNumberType() {
return withMetadataArgument(getNumberType_, arguments)
}
// Deprecated.
var isPossibleNumber_ = require('./build/legacy/isPossibleNumber.js').default
exports.isPossibleNumber = function isPossibleNumber() {
return withMetadataArgument(isPossibleNumber_, arguments)
}
// Deprecated.
var isValidNumber_ = require('./build/legacy/isValidNumber.js').default
exports.isValidNumber = function isValidNumber() {
return withMetadataArgument(isValidNumber_, arguments)
}
// Deprecated.
var isValidNumberForRegion_ = require('./build/legacy/isValidNumberForRegion.js').default
exports.isValidNumberForRegion = function isValidNumberForRegion() {
return withMetadataArgument(isValidNumberForRegion_, arguments)
}
exports.getExampleNumber = min.getExampleNumber
exports.Metadata = min.Metadata
// Deprecated.
var findPhoneNumbers_ = require('./build/legacy/findPhoneNumbers.js').default
exports.findPhoneNumbers = function findPhoneNumbers() {
return withMetadataArgument(findPhoneNumbers_, arguments)
}
// Deprecated.
var searchPhoneNumbers_ = require('./build/legacy/findPhoneNumbers.js').searchPhoneNumbers
exports.searchPhoneNumbers = function searchPhoneNumbers() {
return withMetadataArgument(searchPhoneNumbers_, arguments)
}
// Deprecated.
var PhoneNumberSearch_ = require('./build/legacy/findPhoneNumbersInitialImplementation.js').PhoneNumberSearch
exports.PhoneNumberSearch = function PhoneNumberSearch(text, options) {
return PhoneNumberSearch_.call(this, text, options, metadata)
}
exports.PhoneNumberSearch.prototype = Object.create(PhoneNumberSearch_.prototype, {})
exports.PhoneNumberSearch.prototype.constructor = exports.PhoneNumberSearch
// Deprecated.
exports.findNumbers = min.findNumbers
// Deprecated.
exports.searchNumbers = min.searchNumbers
exports.findPhoneNumbersInText = min.findPhoneNumbersInText
exports.searchPhoneNumbersInText = min.searchPhoneNumbersInText
exports.PhoneNumberMatcher = min.PhoneNumberMatcher
exports.AsYouType = min.AsYouType
exports.getCountries = min.getCountries
exports.getCountryCallingCode = min.getCountryCallingCode
exports.isSupportedCountry = min.isSupportedCountry
exports.getExtPrefix = min.getExtPrefix
exports.parseRFC3966 = min.parseRFC3966
exports.formatRFC3966 = min.formatRFC3966
// Deprecated: `DIGITS` were used by `react-phone-number-input`.
// Replaced by `parseDigits()`.
exports.DIGITS = require('./build/helpers/parseDigits.js').DIGITS
exports.DIGIT_PLACEHOLDER = min.DIGIT_PLACEHOLDER
// `getPhoneCode` name is deprecated
exports.getPhoneCode = min.getCountryCallingCode
exports.formatIncompletePhoneNumber = min.formatIncompletePhoneNumber
exports.parseIncompletePhoneNumber = min.parseIncompletePhoneNumber
exports.parsePhoneNumberCharacter = min.parsePhoneNumberCharacter
exports.parseDigits = min.parseDigits