-
-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathre2.d.ts
More file actions
94 lines (78 loc) · 2.35 KB
/
re2.d.ts
File metadata and controls
94 lines (78 loc) · 2.35 KB
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
/// <reference types="node" />
declare module 're2' {
interface RE2BufferExecArray {
index: number;
input: Buffer;
0: Buffer;
groups?: {
[key: string]: Buffer;
};
indices?: RegExpIndicesArray;
}
interface RE2BufferMatchArray {
index?: number;
input?: Buffer;
0: Buffer;
groups?: {
[key: string]: Buffer;
};
}
interface RE2 extends RegExp {
readonly internalSource: string;
exec(str: string): RegExpExecArray | null;
exec(str: Buffer): RE2BufferExecArray | null;
match(str: string): RegExpMatchArray | null;
match(str: Buffer): RE2BufferMatchArray | null;
test(str: string | Buffer): boolean;
replace<K extends String | Buffer>(
str: K,
replaceValue: string | Buffer
): K;
replace<K extends String | Buffer>(
str: K,
replacer: (substring: string, ...args: any[]) => string | Buffer
): K;
search(str: string | Buffer): number;
split<K extends String | Buffer>(str: K, limit?: number): K[];
}
interface RE2SetOptions {
anchor?: 'unanchored' | 'start' | 'both';
}
interface RE2Set {
readonly size: number;
readonly source: string;
readonly sources: string[];
readonly flags: string;
readonly anchor: 'unanchored' | 'start' | 'both';
match(str: string | Buffer): number[];
test(str: string | Buffer): boolean;
toString(): string;
}
interface RE2SetConstructor {
new (
patterns: Iterable<Buffer | RegExp | RE2 | string>,
flagsOrOptions?: string | Buffer | RE2SetOptions,
options?: RE2SetOptions
): RE2Set;
(
patterns: Iterable<Buffer | RegExp | RE2 | string>,
flagsOrOptions?: string | Buffer | RE2SetOptions,
options?: RE2SetOptions
): RE2Set;
readonly prototype: RE2Set;
}
interface RE2Constructor extends RegExpConstructor {
new (pattern: Buffer | RegExp | RE2 | string): RE2;
new (pattern: Buffer | string, flags?: string | Buffer): RE2;
(pattern: Buffer | RegExp | RE2 | string): RE2;
(pattern: Buffer | string, flags?: string | Buffer): RE2;
readonly prototype: RE2;
unicodeWarningLevel: 'nothing' | 'warnOnce' | 'warn' | 'throw';
getUtf8Length(value: string): number;
getUtf16Length(value: Buffer): number;
Set: RE2SetConstructor;
RE2: RE2Constructor;
}
var RE2: RE2Constructor;
export = RE2;
}