libphonenumber-js 1.10.23 → 1.10.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CODE_OF_CONDUCT.md +78 -0
- package/README.md +16 -6
- package/build/PhoneNumber.js +6 -0
- package/build/PhoneNumber.js.map +1 -1
- package/build/PhoneNumberMatcher.js +53 -62
- package/build/PhoneNumberMatcher.js.map +1 -1
- package/build/PhoneNumberMatcher.test.js +8 -0
- package/build/PhoneNumberMatcher.test.js.map +1 -1
- package/build/findNumbers/Leniency.js +60 -50
- package/build/findNumbers/Leniency.js.map +1 -1
- package/build/findNumbers/matchPhoneNumberStringAgainstPhoneNumber.js +75 -0
- package/build/findNumbers/matchPhoneNumberStringAgainstPhoneNumber.js.map +1 -0
- package/build/format.js +1 -0
- package/build/format.js.map +1 -1
- package/build/helpers/RFC3966.test.js +3 -1
- package/build/helpers/RFC3966.test.js.map +1 -1
- package/build/helpers/extractCountryCallingCode.js +44 -4
- package/build/helpers/extractCountryCallingCode.js.map +1 -1
- package/build/helpers/extractCountryCallingCode.test.js +2 -0
- package/build/helpers/extractCountryCallingCode.test.js.map +1 -1
- package/build/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js +86 -0
- package/build/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js.map +1 -0
- package/build/helpers/extractPhoneContext.js +97 -0
- package/build/helpers/extractPhoneContext.js.map +1 -0
- package/build/helpers/extractPhoneContext.test.js +72 -0
- package/build/helpers/extractPhoneContext.test.js.map +1 -0
- package/build/parse.js +19 -9
- package/build/parse.js.map +1 -1
- package/bundle/libphonenumber-js.min.js +1 -1
- package/bundle/libphonenumber-js.min.js.map +1 -1
- package/bundle/libphonenumber-max.js +1 -1
- package/bundle/libphonenumber-max.js.map +1 -1
- package/bundle/libphonenumber-min.js +1 -1
- package/bundle/libphonenumber-min.js.map +1 -1
- package/bundle/libphonenumber-mobile.js +1 -1
- package/bundle/libphonenumber-mobile.js.map +1 -1
- package/core/index.d.ts +3 -3
- package/custom.d.ts +4 -4
- package/es6/PhoneNumber.js +6 -0
- package/es6/PhoneNumber.js.map +1 -1
- package/es6/PhoneNumberMatcher.js +53 -62
- package/es6/PhoneNumberMatcher.js.map +1 -1
- package/es6/PhoneNumberMatcher.test.js +8 -0
- package/es6/PhoneNumberMatcher.test.js.map +1 -1
- package/es6/findNumbers/Leniency.js +56 -50
- package/es6/findNumbers/Leniency.js.map +1 -1
- package/es6/findNumbers/matchPhoneNumberStringAgainstPhoneNumber.js +66 -0
- package/es6/findNumbers/matchPhoneNumberStringAgainstPhoneNumber.js.map +1 -0
- package/es6/format.js +1 -1
- package/es6/format.js.map +1 -1
- package/es6/helpers/RFC3966.test.js +3 -1
- package/es6/helpers/RFC3966.test.js.map +1 -1
- package/es6/helpers/extractCountryCallingCode.js +44 -4
- package/es6/helpers/extractCountryCallingCode.js.map +1 -1
- package/es6/helpers/extractCountryCallingCode.test.js +2 -0
- package/es6/helpers/extractCountryCallingCode.test.js.map +1 -1
- package/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js +70 -0
- package/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js.map +1 -0
- package/es6/helpers/extractPhoneContext.js +82 -0
- package/es6/helpers/extractPhoneContext.js.map +1 -0
- package/es6/helpers/extractPhoneContext.test.js +66 -0
- package/es6/helpers/extractPhoneContext.test.js.map +1 -0
- package/es6/parse.js +20 -10
- package/es6/parse.js.map +1 -1
- package/examples.mobile.json.d.ts +1 -1
- package/index.cjs.js +1 -1
- package/index.d.ts +3 -3
- package/metadata.full.json +1 -1
- package/metadata.full.json.d.ts +1 -1
- package/metadata.full.json.js +1 -1
- package/metadata.max.json +1 -1
- package/metadata.max.json.d.ts +1 -1
- package/metadata.max.json.js +1 -1
- package/metadata.min.json +1 -1
- package/metadata.min.json.d.ts +1 -1
- package/metadata.min.json.js +1 -1
- package/metadata.mobile.json +1 -1
- package/metadata.mobile.json.d.ts +1 -1
- package/metadata.mobile.json.js +1 -1
- package/min/index.d.ts +3 -3
- package/package.json +4 -4
- package/source/AsYouTypeFormatter.PatternMatcher.d.ts +1 -1
- package/source/PhoneNumber.js +6 -0
- package/source/PhoneNumberMatcher.js +55 -58
- package/source/PhoneNumberMatcher.test.js +4 -0
- package/source/findNumbers/Leniency.js +281 -271
- package/source/findNumbers/matchPhoneNumberStringAgainstPhoneNumber.js +64 -0
- package/source/format.js +1 -1
- package/source/helpers/RFC3966.test.js +3 -0
- package/source/helpers/extractCountryCallingCode.js +48 -3
- package/source/helpers/extractCountryCallingCode.test.js +2 -0
- package/source/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js +74 -0
- package/source/helpers/extractPhoneContext.js +103 -0
- package/source/helpers/extractPhoneContext.test.js +104 -0
- package/source/parse.js +18 -8
package/min/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
NumberFormat,
|
|
16
16
|
NumberingPlan,
|
|
17
17
|
ValidatePhoneNumberLengthResult
|
|
18
|
-
} from '../types';
|
|
18
|
+
} from '../types.d.js';
|
|
19
19
|
|
|
20
20
|
// They say this re-export is required.
|
|
21
21
|
// https://github.com/catamphetamine/libphonenumber-js/pull/290#issuecomment-453281180
|
|
@@ -59,8 +59,8 @@ export function searchNumbers(text: string, options?: CountryCode): IterableIter
|
|
|
59
59
|
export function findNumbers(text: string, options?: { defaultCountry?: CountryCode, v2: true }): NumberFound[];
|
|
60
60
|
export function searchNumbers(text: string, options?: { defaultCountry?: CountryCode, v2: true }): IterableIterator<NumberFound>;
|
|
61
61
|
|
|
62
|
-
export function findPhoneNumbersInText(text: string, options?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string }): NumberFound[];
|
|
63
|
-
export function searchPhoneNumbersInText(text: string, options?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string }): IterableIterator<NumberFound>;
|
|
62
|
+
export function findPhoneNumbersInText(text: string, options?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string, extended?: boolean }): NumberFound[];
|
|
63
|
+
export function searchPhoneNumbersInText(text: string, options?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string, extended?: boolean }): IterableIterator<NumberFound>;
|
|
64
64
|
|
|
65
65
|
export class PhoneNumberMatcher {
|
|
66
66
|
constructor(text: string, options?: { defaultCountry?: CountryCode, v2: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libphonenumber-js",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.26",
|
|
4
4
|
"description": "A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript",
|
|
5
5
|
"main": "index.cjs",
|
|
6
6
|
"module": "index.js",
|
|
@@ -149,11 +149,11 @@
|
|
|
149
149
|
"generate-country-codes": "node --experimental-json-modules runnable/generate-country-codes",
|
|
150
150
|
"test": "node --experimental-json-modules node_modules/mocha/bin/_mocha --colors --bail --reporter spec --require ./test/setup.js \"source/**/*.test.js\" \"test/**/*.test.js\" --recursive",
|
|
151
151
|
"test-coverage": "npm-run-all build:commonjs test-coverage:commonjs",
|
|
152
|
-
"test-coverage:commonjs": "node --experimental-json-modules node_modules/istanbul/lib/cli.js cover -x \"*.test.js\" -x \"build/findNumbers/Leniency.js\" -x \"build/findNumbers/RegExpCache.js\" -x \"build/findNumbers/LRUCache.js\" -x \"build/PhoneNumberMatcher.js\" -x \"build/tools/semver-compare.js\" node_modules/mocha/bin/_mocha -- --colors --reporter dot --require ./test/setup.js \"build/**/*.test.js\" --recursive",
|
|
153
|
-
"test-coverage--does-not-work-with-es-modules": "node --experimental-json-modules node_modules/istanbul/lib/cli.js cover -x \"build/**\" -x \"es6/**\" -x \"*.test.js\" -x \"source/findNumbers/Leniency.js\" -x \"source/findNumbers/RegExpCache.js\" -x \"source/findNumbers/LRUCache.js\" -x \"source/PhoneNumberMatcher.js\" -x \"source/tools/semver-compare.js\" node_modules/mocha/bin/_mocha -- --colors --reporter dot --require ./test/setup.js \"source/**/*.test.js\" \"test/**/*.test.js\" --recursive",
|
|
152
|
+
"test-coverage:commonjs": "node --experimental-json-modules node_modules/istanbul/lib/cli.js cover -x \"*.test.js\" -x \"build/findNumbers/Leniency.js\" -x \"build/findNumbers/matchPhoneNumberStringAgainstPhoneNumber.js\" -x \"build/findNumbers/RegExpCache.js\" -x \"build/findNumbers/LRUCache.js\" -x \"build/PhoneNumberMatcher.js\" -x \"build/tools/semver-compare.js\" node_modules/mocha/bin/_mocha -- --colors --reporter dot --require ./test/setup.js \"build/**/*.test.js\" --recursive",
|
|
153
|
+
"test-coverage--does-not-work-with-es-modules": "node --experimental-json-modules node_modules/istanbul/lib/cli.js cover -x \"build/**\" -x \"es6/**\" -x \"*.test.js\" -x \"source/findNumbers/Leniency.js\" -x \"source/findNumbers/matchPhoneNumberStringAgainstPhoneNumber.js\" -x \"source/findNumbers/RegExpCache.js\" -x \"source/findNumbers/LRUCache.js\" -x \"source/PhoneNumberMatcher.js\" -x \"source/tools/semver-compare.js\" node_modules/mocha/bin/_mocha -- --colors --reporter dot --require ./test/setup.js \"source/**/*.test.js\" \"test/**/*.test.js\" --recursive",
|
|
154
154
|
"test-coverage--nyc--does-not-work-with-es-modules": "cross-env nyc node --experimental-json-modules node_modules/mocha/bin/_mocha --bail --require @babel/register --require ./test/setup.js \"source/**/*.test.js\" \"test/**/*.test.js\"",
|
|
155
155
|
"coveralls--nyc-is-very-slow-and-is-not-used": "nyc report --reporter=text-lcov | coveralls",
|
|
156
|
-
"test-travis": "node --experimental-json-modules node_modules/istanbul/lib/cli.js cover -x \"build/**\" -x \"es6/**\" -x \"*.test.js\" -x \"source/findNumbers/Leniency.js\" -x \"source/findNumbers/RegExpCache.js\" -x \"source/findNumbers/LRUCache.js\" -x \"source/PhoneNumberMatcher.js\" -x \"source/tools/semver-compare.js\" node_modules/mocha/bin/_mocha --report lcovonly -- --colors --reporter spec --require ./test/setup.js \"source/**/*.test.js\" \"test/**/*.test.js\" --recursive",
|
|
156
|
+
"test-travis": "node --experimental-json-modules node_modules/istanbul/lib/cli.js cover -x \"build/**\" -x \"es6/**\" -x \"*.test.js\" -x \"source/findNumbers/Leniency.js\" -x \"source/findNumbers/matchPhoneNumberStringAgainstPhoneNumber.js\" -x \"source/findNumbers/RegExpCache.js\" -x \"source/findNumbers/LRUCache.js\" -x \"source/PhoneNumberMatcher.js\" -x \"source/tools/semver-compare.js\" node_modules/mocha/bin/_mocha --report lcovonly -- --colors --reporter spec --require ./test/setup.js \"source/**/*.test.js\" \"test/**/*.test.js\" --recursive",
|
|
157
157
|
"clean": "rimraf ./build/**/* ./es6/**/*",
|
|
158
158
|
"build:commonjs": "npm-run-all build:commonjs:with-tests build:commonjs:package.json",
|
|
159
159
|
"build:commonjs:before-es-modules": "cross-env BABEL_ENV=commonjs babel ./source --out-dir ./build --source-maps --ignore test.js",
|
package/source/PhoneNumber.js
CHANGED
|
@@ -9,6 +9,12 @@ import formatNumber from './format.js'
|
|
|
9
9
|
const USE_NON_GEOGRAPHIC_COUNTRY_CODE = false
|
|
10
10
|
|
|
11
11
|
export default class PhoneNumber {
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} countryOrCountryCallingCode
|
|
14
|
+
* @param {string} nationalNumber
|
|
15
|
+
* @param {object} metadata — Metadata JSON
|
|
16
|
+
* @return {PhoneNumber}
|
|
17
|
+
*/
|
|
12
18
|
constructor(countryOrCountryCallingCode, nationalNumber, metadata) {
|
|
13
19
|
if (!countryOrCountryCallingCode) {
|
|
14
20
|
throw new TypeError('`country` or `countryCallingCode` not passed')
|
|
@@ -36,7 +36,9 @@ import isValidCandidate, { LEAD_CLASS } from './findNumbers/isValidCandidate.js'
|
|
|
36
36
|
|
|
37
37
|
import { isSupportedCountry } from './metadata.js'
|
|
38
38
|
|
|
39
|
-
import
|
|
39
|
+
import parsePhoneNumber from './parsePhoneNumber.js'
|
|
40
|
+
|
|
41
|
+
const USE_NON_GEOGRAPHIC_COUNTRY_CODE = false
|
|
40
42
|
|
|
41
43
|
const EXTN_PATTERNS_FOR_MATCHING = createExtensionPattern('matching')
|
|
42
44
|
|
|
@@ -143,47 +145,42 @@ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1
|
|
|
143
145
|
export default class PhoneNumberMatcher
|
|
144
146
|
{
|
|
145
147
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* @param util the phone number util to use
|
|
150
|
-
* @param text the character sequence that we will search, null for no text
|
|
151
|
-
* @param country the country to assume for phone numbers not written in international format
|
|
152
|
-
* (with a leading plus, or with the international dialing prefix of the specified region).
|
|
153
|
-
* May be null or "ZZ" if only numbers with a leading plus should be
|
|
154
|
-
* considered.
|
|
155
|
-
* @param leniency the leniency to use when evaluating candidate phone numbers
|
|
156
|
-
* @param maxTries the maximum number of invalid numbers to try before giving up on the text.
|
|
157
|
-
* This is to cover degenerate cases where the text has a lot of false positives in it. Must
|
|
158
|
-
* be {@code >= 0}.
|
|
148
|
+
* @param {string} text — the character sequence that we will search, null for no text.
|
|
149
|
+
* @param {'POSSIBLE'|'VALID'|'STRICT_GROUPING'|'EXACT_GROUPING'} [options.leniency] — The leniency to use when evaluating candidate phone numbers. See `source/findNumbers/Leniency.js` for more details.
|
|
150
|
+
* @param {number} [options.maxTries] — The maximum number of invalid numbers to try before giving up on the text. This is to cover degenerate cases where the text has a lot of false positives in it. Must be >= 0.
|
|
159
151
|
*/
|
|
160
152
|
constructor(text = '', options = {}, metadata)
|
|
161
153
|
{
|
|
162
154
|
options = {
|
|
163
|
-
|
|
155
|
+
v2: options.v2,
|
|
164
156
|
defaultCallingCode: options.defaultCallingCode,
|
|
165
157
|
defaultCountry: options.defaultCountry && isSupportedCountry(options.defaultCountry, metadata) ? options.defaultCountry : undefined,
|
|
166
|
-
leniency: options.leniency || options.extended ? 'POSSIBLE' : 'VALID',
|
|
158
|
+
leniency: options.leniency || (options.extended ? 'POSSIBLE' : 'VALID'),
|
|
167
159
|
maxTries: options.maxTries || MAX_SAFE_INTEGER
|
|
168
160
|
}
|
|
169
161
|
|
|
162
|
+
// Validate `leniency`.
|
|
170
163
|
if (!options.leniency) {
|
|
171
|
-
throw new TypeError('`
|
|
164
|
+
throw new TypeError('`leniency` is required')
|
|
172
165
|
}
|
|
166
|
+
if (options.leniency !== 'POSSIBLE' && options.leniency !== 'VALID') {
|
|
167
|
+
throw new TypeError(`Invalid \`leniency\`: "${options.leniency}". Supported values: "POSSIBLE", "VALID".`)
|
|
168
|
+
}
|
|
173
169
|
|
|
170
|
+
// Validate `maxTries`.
|
|
174
171
|
if (options.maxTries < 0) {
|
|
175
|
-
throw new TypeError('`maxTries`
|
|
172
|
+
throw new TypeError('`maxTries` must be `>= 0`')
|
|
176
173
|
}
|
|
177
174
|
|
|
178
175
|
this.text = text
|
|
179
176
|
this.options = options
|
|
180
177
|
this.metadata = metadata
|
|
181
178
|
|
|
182
|
-
|
|
179
|
+
// The degree of phone number validation.
|
|
183
180
|
this.leniency = Leniency[options.leniency]
|
|
184
181
|
|
|
185
182
|
if (!this.leniency) {
|
|
186
|
-
throw new TypeError(`Unknown leniency: ${options.leniency}
|
|
183
|
+
throw new TypeError(`Unknown leniency: "${options.leniency}"`)
|
|
187
184
|
}
|
|
188
185
|
|
|
189
186
|
/** The maximum number of retries after matching an invalid number. */
|
|
@@ -191,7 +188,6 @@ export default class PhoneNumberMatcher
|
|
|
191
188
|
|
|
192
189
|
this.PATTERN = new RegExp(PATTERN, 'ig')
|
|
193
190
|
|
|
194
|
-
|
|
195
191
|
/** The iteration tristate. */
|
|
196
192
|
this.state = 'NOT_READY'
|
|
197
193
|
|
|
@@ -233,21 +229,37 @@ export default class PhoneNumberMatcher
|
|
|
233
229
|
|
|
234
230
|
if (match) {
|
|
235
231
|
if (this.options.v2) {
|
|
236
|
-
const phoneNumber = new PhoneNumber(
|
|
237
|
-
match.country || match.countryCallingCode,
|
|
238
|
-
match.phone,
|
|
239
|
-
this.metadata
|
|
240
|
-
)
|
|
241
|
-
if (match.ext) {
|
|
242
|
-
phoneNumber.ext = match.ext
|
|
243
|
-
}
|
|
244
232
|
return {
|
|
245
233
|
startsAt: match.startsAt,
|
|
246
234
|
endsAt: match.endsAt,
|
|
247
|
-
number: phoneNumber
|
|
235
|
+
number: match.phoneNumber
|
|
248
236
|
}
|
|
249
|
-
}
|
|
250
|
-
|
|
237
|
+
} else {
|
|
238
|
+
const { phoneNumber } = match
|
|
239
|
+
|
|
240
|
+
const result = {
|
|
241
|
+
startsAt: match.startsAt,
|
|
242
|
+
endsAt: match.endsAt,
|
|
243
|
+
phone: phoneNumber.nationalNumber
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (phoneNumber.country) {
|
|
247
|
+
/* istanbul ignore if */
|
|
248
|
+
if (USE_NON_GEOGRAPHIC_COUNTRY_CODE && country === '001') {
|
|
249
|
+
result.countryCallingCode = phoneNumber.countryCallingCode
|
|
250
|
+
} else {
|
|
251
|
+
result.country = phoneNumber.country
|
|
252
|
+
}
|
|
253
|
+
} else {
|
|
254
|
+
result.countryCallingCode = phoneNumber.countryCallingCode
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (phoneNumber.ext) {
|
|
258
|
+
result.ext = phoneNumber.ext
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return result
|
|
262
|
+
}
|
|
251
263
|
}
|
|
252
264
|
}
|
|
253
265
|
|
|
@@ -302,7 +314,7 @@ export default class PhoneNumberMatcher
|
|
|
302
314
|
}
|
|
303
315
|
|
|
304
316
|
/**
|
|
305
|
-
* Parses a phone number from the `candidate` using `
|
|
317
|
+
* Parses a phone number from the `candidate` using `parse` and
|
|
306
318
|
* verifies it matches the requested `leniency`. If parsing and verification succeed,
|
|
307
319
|
* a corresponding `PhoneNumberMatch` is returned, otherwise this method returns `null`.
|
|
308
320
|
*
|
|
@@ -315,8 +327,9 @@ export default class PhoneNumberMatcher
|
|
|
315
327
|
return
|
|
316
328
|
}
|
|
317
329
|
|
|
318
|
-
const
|
|
319
|
-
candidate,
|
|
330
|
+
const phoneNumber = parsePhoneNumber(
|
|
331
|
+
candidate,
|
|
332
|
+
{
|
|
320
333
|
extended: true,
|
|
321
334
|
defaultCountry: this.options.defaultCountry,
|
|
322
335
|
defaultCallingCode: this.options.defaultCallingCode
|
|
@@ -324,36 +337,20 @@ export default class PhoneNumberMatcher
|
|
|
324
337
|
this.metadata
|
|
325
338
|
)
|
|
326
339
|
|
|
327
|
-
if (!
|
|
340
|
+
if (!phoneNumber) {
|
|
328
341
|
return
|
|
329
342
|
}
|
|
330
343
|
|
|
331
|
-
if (
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
// // TODO: stop clearing all values here and switch all users over
|
|
335
|
-
// // to using rawInput() rather than the rawString() of PhoneNumberMatch.
|
|
336
|
-
// number.clearCountryCodeSource()
|
|
337
|
-
// number.clearRawInput()
|
|
338
|
-
// number.clearPreferredDomesticCarrierCode()
|
|
344
|
+
if (!phoneNumber.isPossible()) {
|
|
345
|
+
return
|
|
346
|
+
}
|
|
339
347
|
|
|
340
|
-
|
|
348
|
+
if (this.leniency(phoneNumber, candidate, this.metadata, this.regExpCache)) {
|
|
349
|
+
return {
|
|
341
350
|
startsAt: offset,
|
|
342
351
|
endsAt: offset + candidate.length,
|
|
343
|
-
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
if (number.country && number.country !== '001') {
|
|
347
|
-
result.country = number.country
|
|
348
|
-
} else {
|
|
349
|
-
result.countryCallingCode = number.countryCallingCode
|
|
352
|
+
phoneNumber
|
|
350
353
|
}
|
|
351
|
-
|
|
352
|
-
if (number.ext) {
|
|
353
|
-
result.ext = number.ext
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
return result
|
|
357
354
|
}
|
|
358
355
|
}
|
|
359
356
|
|
|
@@ -71,4 +71,8 @@ describe('PhoneNumberMatcher', () => {
|
|
|
71
71
|
test('+54 23 1234 0000', 'AR', '2312340000')
|
|
72
72
|
test('023 1234 0000', 'AR', '2312340000')
|
|
73
73
|
})
|
|
74
|
+
|
|
75
|
+
it('should only support the supported leniency values', function() {
|
|
76
|
+
expect(() => new PhoneNumberMatcher('+54 23 1234 0000', { leniency: 'STRICT_GROUPING', v2: true }, metadata)).to.throw('Supported values: "POSSIBLE", "VALID".')
|
|
77
|
+
})
|
|
74
78
|
})
|