forked from catamphetamine/libphonenumber-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom.d.ts
137 lines (112 loc) · 6.25 KB
/
custom.d.ts
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
// `/custom` export is deprecated.
// Use `/core` sub-package instead.
import {
Metadata,
PhoneNumber,
E164Number,
CountryCallingCode,
CountryCode,
CarrierCode,
NationalNumber,
Extension,
ParseError,
NumberFoundLegacy,
NumberFound,
NumberType,
NumberFormat
} from './types';
import {
ParsedNumber,
FormatNumberOptions,
ParseNumberOptions
} from './index';
export {
Metadata,
PhoneNumber,
E164Number,
CountryCallingCode,
CountryCode,
CarrierCode,
NationalNumber,
Extension,
FormatNumberOptions,
ParsedNumber,
ParseNumberOptions,
ParseError,
NumberFoundLegacy,
NumberFound,
NumberFormat,
NumberType
};
export function parsePhoneNumber(text: string, metadata: Metadata): PhoneNumber;
export function parsePhoneNumber(text: string, defaultCountry: CountryCode, metadata: Metadata): PhoneNumber;
export function parsePhoneNumberFromString(text: string, metadata: Metadata): PhoneNumber;
export function parsePhoneNumberFromString(text: string, defaultCountry: CountryCode, metadata: Metadata): PhoneNumber;
export function parse(text: string, metadata: Metadata): ParsedNumber;
export function parse(text: string, options: CountryCode | ParseNumberOptions, metadata: Metadata): ParsedNumber;
export function parseNumber(text: string, metadata: Metadata): ParsedNumber;
export function parseNumber(text: string, options: CountryCode | ParseNumberOptions, metadata: Metadata): ParsedNumber;
// `format()` and `formatCustom` are deprecated.
// Use `formatNumber()` and `formatNumberCustom()` instead.
export function format(parsedNumber: ParsedNumber, format: NumberFormat, metadata: Metadata): string;
export function format(phone: NationalNumber, format: NumberFormat, metadata: Metadata): string;
export function format(phone: NationalNumber, country: CountryCode, format: NumberFormat, metadata: Metadata): string;
export function formatNumber(parsedNumber: ParsedNumber, format: NumberFormat, metadata: Metadata): string;
export function formatNumber(parsedNumber: ParsedNumber, format: NumberFormat, options: FormatNumberOptions, metadata: Metadata): string;
export function formatNumber(phone: NationalNumber, format: NumberFormat, metadata: Metadata): string;
export function formatNumber(phone: NationalNumber, format: NumberFormat, options: FormatNumberOptions, metadata: Metadata): string;
export function formatNumber(phone: NationalNumber, country: CountryCode, format: NumberFormat, metadata: Metadata): string;
export function formatNumber(phone: NationalNumber, country: CountryCode, format: NumberFormat, options: FormatNumberOptions, metadata: Metadata): string;
export function getNumberType(parsedNumber: ParsedNumber, metadata: Metadata): NumberType;
export function getNumberType(phone: NationalNumber, metadata: Metadata): NumberType;
export function getNumberType(phone: NationalNumber, country: CountryCode, metadata: Metadata): NumberType;
export function getExampleNumber(country: CountryCode, examples: { [country in CountryCode]: NationalNumber }, metadata: Metadata): PhoneNumber | undefined;
export function isPossibleNumber(parsedNumber: ParsedNumber, metadata: Metadata): boolean;
export function isPossibleNumber(phone: NationalNumber, metadata: Metadata): boolean;
export function isPossibleNumber(phone: NationalNumber, country: CountryCode, metadata: Metadata): boolean;
export function isValidNumber(parsedNumber: ParsedNumber, metadata: Metadata): boolean;
export function isValidNumber(phone: NationalNumber, metadata: Metadata): boolean;
export function isValidNumber(phone: NationalNumber, country: CountryCode, metadata: Metadata): boolean;
export function isValidNumberForRegion(phone: NationalNumber, country: CountryCode, metadata: Metadata): boolean;
// Deprecated.
export function findParsedNumbers(text: string, metadata: Metadata): NumberFoundLegacy[];
export function findParsedNumbers(text: string, options: CountryCode | { defaultCountry?: CountryCode }, metadata: Metadata): NumberFoundLegacy[];
// Deprecated.
export function searchParsedNumbers(text: string, metadata: Metadata): IterableIterator<NumberFoundLegacy>;
export function searchParsedNumbers(text: string, options: CountryCode | { defaultCountry?: CountryCode }, metadata: Metadata): IterableIterator<NumberFoundLegacy>;
// Deprecated.
export class ParsedNumberSearch {
constructor(text: string, metadata: Metadata);
constructor(text: string, options: { defaultCountry?: CountryCode }, metadata: Metadata);
hasNext(): boolean;
next(): NumberFoundLegacy | undefined;
}
export function findNumbers(text: string, metadata: Metadata): NumberFoundLegacy[];
export function findNumbers(text: string, options: CountryCode | { defaultCountry?: CountryCode, v2: true }, metadata: Metadata): NumberFound[];
export function searchNumbers(text: string, metadata: Metadata): IterableIterator<NumberFoundLegacy>;
export function searchNumbers(text: string, options: CountryCode | { defaultCountry?: CountryCode, v2: true }, metadata: Metadata): IterableIterator<NumberFound>;
export class PhoneNumberMatcher {
constructor(text: string, metadata: Metadata);
constructor(text: string, options: { defaultCountry?: CountryCode, v2: true }, metadata: Metadata);
hasNext(): boolean;
next(): NumberFound | undefined;
}
export function getCountryCallingCode(countryCode: CountryCode, metadata: Metadata): CountryCallingCode;
// Deprecated
export function getPhoneCode(countryCode: CountryCode, metadata: Metadata): CountryCallingCode;
export function getExtPrefix(countryCode: CountryCode, metadata: Metadata): string;
export function isSupportedCountry(countryCode: CountryCode, metadata: Metadata): boolean;
export function formatIncompletePhoneNumber(number: string, metadata: Metadata): string;
export function formatIncompletePhoneNumber(number: string, countryCode: CountryCode, metadata: Metadata): string;
export function parseIncompletePhoneNumber(text: string): string;
export function parsePhoneNumberCharacter(character: string): string;
export function parseDigits(character: string): string;
export class AsYouType {
constructor(defaultCountryCode: CountryCode | undefined, metadata: Metadata);
input(text: string): string;
reset(): void;
country: CountryCode | undefined;
getNumber(): PhoneNumber | undefined;
getNationalNumber(): string;
getTemplate(): string | undefined;
}