libphonenumber-js 1.10.40 → 1.10.41

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/core/package.json CHANGED
@@ -6,7 +6,6 @@
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": {
9
- "types": "./index.d.ts",
10
9
  "import": "./index.js",
11
10
  "require": "./index.cjs"
12
11
  }
@@ -0,0 +1,102 @@
1
+ import {
2
+ MetadataJson,
3
+ Examples,
4
+ PhoneNumber,
5
+ E164Number,
6
+ CountryCallingCode,
7
+ CountryCode,
8
+ CarrierCode,
9
+ NationalNumber,
10
+ Extension,
11
+ ParseError,
12
+ NumberFoundLegacy,
13
+ NumberFound,
14
+ NumberType,
15
+ NumberFormat,
16
+ NumberingPlan,
17
+ ValidatePhoneNumberLengthResult
18
+ } from '../types.d.js';
19
+
20
+ // They say this re-export is required.
21
+ // https://github.com/catamphetamine/libphonenumber-js/pull/290#issuecomment-453281180
22
+ export {
23
+ MetadataJson,
24
+ Examples,
25
+ PhoneNumber,
26
+ E164Number,
27
+ CountryCallingCode,
28
+ CountryCode,
29
+ CarrierCode,
30
+ NationalNumber,
31
+ Extension,
32
+ ParseError,
33
+ NumberFoundLegacy,
34
+ NumberFound,
35
+ NumberType,
36
+ NumberFormat,
37
+ NumberingPlan,
38
+ ValidatePhoneNumberLengthResult
39
+ };
40
+
41
+ // `parsePhoneNumber()` named export has been renamed to `parsePhoneNumberWithError()`.
42
+ export function parsePhoneNumber(text: string, defaultCountry?: CountryCode): PhoneNumber;
43
+
44
+ export function parsePhoneNumberWithError(text: string, defaultCountry?: CountryCode): PhoneNumber;
45
+
46
+ // `parsePhoneNumberFromString()` named export is now considered legacy:
47
+ // it has been promoted to a default export due to being too verbose.
48
+ export function parsePhoneNumberFromString(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string, extract?: boolean }): PhoneNumber | undefined;
49
+
50
+ export default parsePhoneNumberFromString;
51
+
52
+ export function isValidPhoneNumber(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string }): boolean;
53
+ export function isPossiblePhoneNumber(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string }): boolean;
54
+ export function validatePhoneNumberLength(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string }): ValidatePhoneNumberLengthResult | undefined;
55
+
56
+ export function findNumbers(text: string, options?: CountryCode): NumberFoundLegacy[];
57
+ export function searchNumbers(text: string, options?: CountryCode): IterableIterator<NumberFoundLegacy>;
58
+
59
+ export function findNumbers(text: string, options?: { defaultCountry?: CountryCode, v2: true }): NumberFound[];
60
+ export function searchNumbers(text: string, options?: { defaultCountry?: CountryCode, v2: true }): IterableIterator<NumberFound>;
61
+
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
+
65
+ export class PhoneNumberMatcher {
66
+ constructor(text: string, options?: { defaultCountry?: CountryCode, v2: true });
67
+ hasNext(): boolean;
68
+ next(): NumberFound | undefined;
69
+ }
70
+
71
+ export function isSupportedCountry(countryCode: CountryCode): boolean;
72
+ export function getCountries(): CountryCode[];
73
+ export function getCountryCallingCode(countryCode: CountryCode): CountryCallingCode;
74
+ export function getExtPrefix(countryCode: CountryCode): string;
75
+
76
+ export function getExampleNumber(country: CountryCode, examples: Examples): PhoneNumber | undefined;
77
+
78
+ export function formatIncompletePhoneNumber(number: string, countryCode?: CountryCode): string;
79
+ export function parseIncompletePhoneNumber(text: string): string;
80
+ export function parsePhoneNumberCharacter(character: string): string;
81
+ export function parseDigits(character: string): string;
82
+
83
+ export class AsYouType {
84
+ constructor(defaultCountryCode?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string });
85
+ input(text: string): string;
86
+ reset(): void;
87
+ getNumber(): PhoneNumber | undefined;
88
+ getNumberValue(): E164Number | undefined;
89
+ getChars(): string;
90
+ getTemplate(): string;
91
+ getCallingCode(): string | undefined;
92
+ getCountry(): CountryCode | undefined;
93
+ isInternational(): boolean;
94
+ isPossible(): boolean;
95
+ isValid(): boolean;
96
+ }
97
+
98
+ export class Metadata {
99
+ constructor();
100
+ selectNumberingPlan(country: CountryCode): void;
101
+ numberingPlan?: NumberingPlan;
102
+ }
package/max/index.d.ts ADDED
@@ -0,0 +1,102 @@
1
+ import {
2
+ MetadataJson,
3
+ Examples,
4
+ PhoneNumber,
5
+ E164Number,
6
+ CountryCallingCode,
7
+ CountryCode,
8
+ CarrierCode,
9
+ NationalNumber,
10
+ Extension,
11
+ ParseError,
12
+ NumberFoundLegacy,
13
+ NumberFound,
14
+ NumberType,
15
+ NumberFormat,
16
+ NumberingPlan,
17
+ ValidatePhoneNumberLengthResult
18
+ } from '../types.d.js';
19
+
20
+ // They say this re-export is required.
21
+ // https://github.com/catamphetamine/libphonenumber-js/pull/290#issuecomment-453281180
22
+ export {
23
+ MetadataJson,
24
+ Examples,
25
+ PhoneNumber,
26
+ E164Number,
27
+ CountryCallingCode,
28
+ CountryCode,
29
+ CarrierCode,
30
+ NationalNumber,
31
+ Extension,
32
+ ParseError,
33
+ NumberFoundLegacy,
34
+ NumberFound,
35
+ NumberType,
36
+ NumberFormat,
37
+ NumberingPlan,
38
+ ValidatePhoneNumberLengthResult
39
+ };
40
+
41
+ // `parsePhoneNumber()` named export has been renamed to `parsePhoneNumberWithError()`.
42
+ export function parsePhoneNumber(text: string, defaultCountry?: CountryCode): PhoneNumber;
43
+
44
+ export function parsePhoneNumberWithError(text: string, defaultCountry?: CountryCode): PhoneNumber;
45
+
46
+ // `parsePhoneNumberFromString()` named export is now considered legacy:
47
+ // it has been promoted to a default export due to being too verbose.
48
+ export function parsePhoneNumberFromString(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string, extract?: boolean }): PhoneNumber | undefined;
49
+
50
+ export default parsePhoneNumberFromString;
51
+
52
+ export function isValidPhoneNumber(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string }): boolean;
53
+ export function isPossiblePhoneNumber(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string }): boolean;
54
+ export function validatePhoneNumberLength(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string }): ValidatePhoneNumberLengthResult | undefined;
55
+
56
+ export function findNumbers(text: string, options?: CountryCode): NumberFoundLegacy[];
57
+ export function searchNumbers(text: string, options?: CountryCode): IterableIterator<NumberFoundLegacy>;
58
+
59
+ export function findNumbers(text: string, options?: { defaultCountry?: CountryCode, v2: true }): NumberFound[];
60
+ export function searchNumbers(text: string, options?: { defaultCountry?: CountryCode, v2: true }): IterableIterator<NumberFound>;
61
+
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
+
65
+ export class PhoneNumberMatcher {
66
+ constructor(text: string, options?: { defaultCountry?: CountryCode, v2: true });
67
+ hasNext(): boolean;
68
+ next(): NumberFound | undefined;
69
+ }
70
+
71
+ export function isSupportedCountry(countryCode: CountryCode): boolean;
72
+ export function getCountries(): CountryCode[];
73
+ export function getCountryCallingCode(countryCode: CountryCode): CountryCallingCode;
74
+ export function getExtPrefix(countryCode: CountryCode): string;
75
+
76
+ export function getExampleNumber(country: CountryCode, examples: Examples): PhoneNumber | undefined;
77
+
78
+ export function formatIncompletePhoneNumber(number: string, countryCode?: CountryCode): string;
79
+ export function parseIncompletePhoneNumber(text: string): string;
80
+ export function parsePhoneNumberCharacter(character: string): string;
81
+ export function parseDigits(character: string): string;
82
+
83
+ export class AsYouType {
84
+ constructor(defaultCountryCode?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string });
85
+ input(text: string): string;
86
+ reset(): void;
87
+ getNumber(): PhoneNumber | undefined;
88
+ getNumberValue(): E164Number | undefined;
89
+ getChars(): string;
90
+ getTemplate(): string;
91
+ getCallingCode(): string | undefined;
92
+ getCountry(): CountryCode | undefined;
93
+ isInternational(): boolean;
94
+ isPossible(): boolean;
95
+ isValid(): boolean;
96
+ }
97
+
98
+ export class Metadata {
99
+ constructor();
100
+ selectNumberingPlan(country: CountryCode): void;
101
+ numberingPlan?: NumberingPlan;
102
+ }
package/max/package.json CHANGED
@@ -3,11 +3,9 @@
3
3
  "name": "libphonenumber-js/max",
4
4
  "main": "index.cjs",
5
5
  "module": "index.js",
6
- "types": "../min/index.d.ts",
7
6
  "type": "module",
8
7
  "exports": {
9
8
  ".": {
10
- "types": "../min/index.d.ts",
11
9
  "import": "./index.js",
12
10
  "require": "./index.cjs"
13
11
  }
package/min/package.json CHANGED
@@ -6,7 +6,6 @@
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": {
9
- "types": "../min/index.d.ts",
10
9
  "import": "./index.js",
11
10
  "require": "./index.cjs"
12
11
  }
@@ -0,0 +1,102 @@
1
+ import {
2
+ MetadataJson,
3
+ Examples,
4
+ PhoneNumber,
5
+ E164Number,
6
+ CountryCallingCode,
7
+ CountryCode,
8
+ CarrierCode,
9
+ NationalNumber,
10
+ Extension,
11
+ ParseError,
12
+ NumberFoundLegacy,
13
+ NumberFound,
14
+ NumberType,
15
+ NumberFormat,
16
+ NumberingPlan,
17
+ ValidatePhoneNumberLengthResult
18
+ } from '../types.d.js';
19
+
20
+ // They say this re-export is required.
21
+ // https://github.com/catamphetamine/libphonenumber-js/pull/290#issuecomment-453281180
22
+ export {
23
+ MetadataJson,
24
+ Examples,
25
+ PhoneNumber,
26
+ E164Number,
27
+ CountryCallingCode,
28
+ CountryCode,
29
+ CarrierCode,
30
+ NationalNumber,
31
+ Extension,
32
+ ParseError,
33
+ NumberFoundLegacy,
34
+ NumberFound,
35
+ NumberType,
36
+ NumberFormat,
37
+ NumberingPlan,
38
+ ValidatePhoneNumberLengthResult
39
+ };
40
+
41
+ // `parsePhoneNumber()` named export has been renamed to `parsePhoneNumberWithError()`.
42
+ export function parsePhoneNumber(text: string, defaultCountry?: CountryCode): PhoneNumber;
43
+
44
+ export function parsePhoneNumberWithError(text: string, defaultCountry?: CountryCode): PhoneNumber;
45
+
46
+ // `parsePhoneNumberFromString()` named export is now considered legacy:
47
+ // it has been promoted to a default export due to being too verbose.
48
+ export function parsePhoneNumberFromString(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string, extract?: boolean }): PhoneNumber | undefined;
49
+
50
+ export default parsePhoneNumberFromString;
51
+
52
+ export function isValidPhoneNumber(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string }): boolean;
53
+ export function isPossiblePhoneNumber(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string }): boolean;
54
+ export function validatePhoneNumberLength(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string }): ValidatePhoneNumberLengthResult | undefined;
55
+
56
+ export function findNumbers(text: string, options?: CountryCode): NumberFoundLegacy[];
57
+ export function searchNumbers(text: string, options?: CountryCode): IterableIterator<NumberFoundLegacy>;
58
+
59
+ export function findNumbers(text: string, options?: { defaultCountry?: CountryCode, v2: true }): NumberFound[];
60
+ export function searchNumbers(text: string, options?: { defaultCountry?: CountryCode, v2: true }): IterableIterator<NumberFound>;
61
+
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
+
65
+ export class PhoneNumberMatcher {
66
+ constructor(text: string, options?: { defaultCountry?: CountryCode, v2: true });
67
+ hasNext(): boolean;
68
+ next(): NumberFound | undefined;
69
+ }
70
+
71
+ export function isSupportedCountry(countryCode: CountryCode): boolean;
72
+ export function getCountries(): CountryCode[];
73
+ export function getCountryCallingCode(countryCode: CountryCode): CountryCallingCode;
74
+ export function getExtPrefix(countryCode: CountryCode): string;
75
+
76
+ export function getExampleNumber(country: CountryCode, examples: Examples): PhoneNumber | undefined;
77
+
78
+ export function formatIncompletePhoneNumber(number: string, countryCode?: CountryCode): string;
79
+ export function parseIncompletePhoneNumber(text: string): string;
80
+ export function parsePhoneNumberCharacter(character: string): string;
81
+ export function parseDigits(character: string): string;
82
+
83
+ export class AsYouType {
84
+ constructor(defaultCountryCode?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string });
85
+ input(text: string): string;
86
+ reset(): void;
87
+ getNumber(): PhoneNumber | undefined;
88
+ getNumberValue(): E164Number | undefined;
89
+ getChars(): string;
90
+ getTemplate(): string;
91
+ getCallingCode(): string | undefined;
92
+ getCountry(): CountryCode | undefined;
93
+ isInternational(): boolean;
94
+ isPossible(): boolean;
95
+ isValid(): boolean;
96
+ }
97
+
98
+ export class Metadata {
99
+ constructor();
100
+ selectNumberingPlan(country: CountryCode): void;
101
+ numberingPlan?: NumberingPlan;
102
+ }
@@ -0,0 +1,102 @@
1
+ import {
2
+ MetadataJson,
3
+ Examples,
4
+ PhoneNumber,
5
+ E164Number,
6
+ CountryCallingCode,
7
+ CountryCode,
8
+ CarrierCode,
9
+ NationalNumber,
10
+ Extension,
11
+ ParseError,
12
+ NumberFoundLegacy,
13
+ NumberFound,
14
+ NumberType,
15
+ NumberFormat,
16
+ NumberingPlan,
17
+ ValidatePhoneNumberLengthResult
18
+ } from '../types.d.js';
19
+
20
+ // They say this re-export is required.
21
+ // https://github.com/catamphetamine/libphonenumber-js/pull/290#issuecomment-453281180
22
+ export {
23
+ MetadataJson,
24
+ Examples,
25
+ PhoneNumber,
26
+ E164Number,
27
+ CountryCallingCode,
28
+ CountryCode,
29
+ CarrierCode,
30
+ NationalNumber,
31
+ Extension,
32
+ ParseError,
33
+ NumberFoundLegacy,
34
+ NumberFound,
35
+ NumberType,
36
+ NumberFormat,
37
+ NumberingPlan,
38
+ ValidatePhoneNumberLengthResult
39
+ };
40
+
41
+ // `parsePhoneNumber()` named export has been renamed to `parsePhoneNumberWithError()`.
42
+ export function parsePhoneNumber(text: string, defaultCountry?: CountryCode): PhoneNumber;
43
+
44
+ export function parsePhoneNumberWithError(text: string, defaultCountry?: CountryCode): PhoneNumber;
45
+
46
+ // `parsePhoneNumberFromString()` named export is now considered legacy:
47
+ // it has been promoted to a default export due to being too verbose.
48
+ export function parsePhoneNumberFromString(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string, extract?: boolean }): PhoneNumber | undefined;
49
+
50
+ export default parsePhoneNumberFromString;
51
+
52
+ export function isValidPhoneNumber(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string }): boolean;
53
+ export function isPossiblePhoneNumber(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string }): boolean;
54
+ export function validatePhoneNumberLength(text: string, defaultCountry?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string }): ValidatePhoneNumberLengthResult | undefined;
55
+
56
+ export function findNumbers(text: string, options?: CountryCode): NumberFoundLegacy[];
57
+ export function searchNumbers(text: string, options?: CountryCode): IterableIterator<NumberFoundLegacy>;
58
+
59
+ export function findNumbers(text: string, options?: { defaultCountry?: CountryCode, v2: true }): NumberFound[];
60
+ export function searchNumbers(text: string, options?: { defaultCountry?: CountryCode, v2: true }): IterableIterator<NumberFound>;
61
+
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
+
65
+ export class PhoneNumberMatcher {
66
+ constructor(text: string, options?: { defaultCountry?: CountryCode, v2: true });
67
+ hasNext(): boolean;
68
+ next(): NumberFound | undefined;
69
+ }
70
+
71
+ export function isSupportedCountry(countryCode: CountryCode): boolean;
72
+ export function getCountries(): CountryCode[];
73
+ export function getCountryCallingCode(countryCode: CountryCode): CountryCallingCode;
74
+ export function getExtPrefix(countryCode: CountryCode): string;
75
+
76
+ export function getExampleNumber(country: CountryCode, examples: Examples): PhoneNumber | undefined;
77
+
78
+ export function formatIncompletePhoneNumber(number: string, countryCode?: CountryCode): string;
79
+ export function parseIncompletePhoneNumber(text: string): string;
80
+ export function parsePhoneNumberCharacter(character: string): string;
81
+ export function parseDigits(character: string): string;
82
+
83
+ export class AsYouType {
84
+ constructor(defaultCountryCode?: CountryCode | { defaultCountry?: CountryCode, defaultCallingCode?: string });
85
+ input(text: string): string;
86
+ reset(): void;
87
+ getNumber(): PhoneNumber | undefined;
88
+ getNumberValue(): E164Number | undefined;
89
+ getChars(): string;
90
+ getTemplate(): string;
91
+ getCallingCode(): string | undefined;
92
+ getCountry(): CountryCode | undefined;
93
+ isInternational(): boolean;
94
+ isPossible(): boolean;
95
+ isValid(): boolean;
96
+ }
97
+
98
+ export class Metadata {
99
+ constructor();
100
+ selectNumberingPlan(country: CountryCode): void;
101
+ numberingPlan?: NumberingPlan;
102
+ }
@@ -3,11 +3,9 @@
3
3
  "name": "libphonenumber-js/mobile",
4
4
  "main": "index.cjs",
5
5
  "module": "index.js",
6
- "types": "../min/index.d.ts",
7
6
  "type": "module",
8
7
  "exports": {
9
8
  ".": {
10
- "types": "../min/index.d.ts",
11
9
  "import": "./index.js",
12
10
  "require": "./index.cjs"
13
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libphonenumber-js",
3
- "version": "1.10.40",
3
+ "version": "1.10.41",
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",
@@ -143,9 +143,10 @@
143
143
  "build:commonjs:with-tests": "cross-env BABEL_ENV=commonjs babel ./source --out-dir ./build --source-maps",
144
144
  "build:commonjs:package.json": "node runnable/create-commonjs-package-json.js",
145
145
  "build:commonjs:create-typescript-definitions": "rimraf --verbose --glob ./*.d.cts ./!(node_modules)/**/*.d.cts && cpy **/{index,metadata*,examples*}.d.ts . --rename={{basename}}.cts && renamer --find d.cts.ts --replace d.cts ./*.d.cts.ts ./!(node_modules)/**/*.d.cts.ts",
146
+ "build:modules:copy-typescript-definitions": "cpy --flat min/index.d.ts max && cpy --flat min/index.d.ts mobile",
146
147
  "build:modules": "cross-env BABEL_ENV=es6 babel ./source --out-dir ./es6 --source-maps --ignore test.js",
147
148
  "build:bundle": "rollup --config rollup.config.mjs",
148
- "build": "npm-run-all clean build:commonjs build:modules build:bundle",
149
+ "build": "npm-run-all clean build:modules:copy-typescript-definitions build:modules build:commonjs build:bundle",
149
150
  "prepublishOnly": "npm run metadata:generate && npm run generate-country-codes && crlf --set=LF metadata.*.json && npm-run-all build test"
150
151
  },
151
152
  "repository": {