-
Notifications
You must be signed in to change notification settings - Fork 23
/
index.d.ts
68 lines (57 loc) · 1.99 KB
/
index.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
declare namespace ParseTorrentTitle {
interface ParserOptions {
skipIfAlreadyFound?: boolean;
type?: string;
value?: string;
}
interface DefaultParserResult {
title: string;
year?: number;
resolution?: string;
extended?: boolean;
unrated?: boolean;
proper?: boolean;
repack?: boolean;
convert?: boolean;
hardcoded?: boolean;
retail?: boolean;
remastered?: boolean;
region?: string;
container?: string;
source?: string;
codec?: string;
audio?: string;
group?: string;
season?: number;
episode?: number;
language?: string;
}
interface Handler<ParserResult = DefaultParserResult> {
(input: { title: string, result: ParserResult }): void;
(input: { title: string }): void;
(input: { result: ParserResult }): void;
}
interface ParseFunction<ParserResult = DefaultParserResult> {
(title: string): ParserResult;
}
interface AddHandlerFunction<ParserResult = DefaultParserResult> {
(handlerName: string, handler: RegExp, options?: ParserOptions): void;
(handlerName: string, handler: Handler<ParserResult>): void;
(handler: Handler<ParserResult>): void;
}
interface AddDefaultsFunction {
(parser: Parser): void;
}
class Parser<ParserResult = DefaultParserResult> {
constructor();
addHandler: AddHandlerFunction<ParserResult>;
parse: ParseFunction<ParserResult>;
}
}
declare module "parse-torrent-title" {
export interface DefaultParserResult extends ParseTorrentTitle.DefaultParserResult { }
export class Parser<ParserResult = DefaultParserResult> extends ParseTorrentTitle.Parser<ParserResult> { }
export const parse: ParseTorrentTitle.ParseFunction;
export const addHandler: ParseTorrentTitle.AddHandlerFunction;
export const addDefaults: ParseTorrentTitle.AddDefaultsFunction;
}